* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: #1f2430; background: #f6f7f9; }
.hidden { display: none !important; }
.error { color: #c0392b; min-height: 1.2em; }

/* Login */
.login { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login form { background: #fff; padding: 2rem; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.08); width: 320px; }
.login input, .login button { width: 100%; padding: .7rem; margin-top: .6rem; border-radius: 8px; border: 1px solid #d5d9e0; font-size: 1rem; }
.login button { background: #2d6cdf; color: #fff; border: none; cursor: pointer; }

/* Layout */
.app { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; }
.sidebar { background: #fff; border-right: 1px solid #e4e7ec; padding: 1rem; }
.main { padding: 1rem 1.5rem; }
.topnav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.topnav button { padding: .4rem .8rem; border: 1px solid #d5d9e0; background: #fff; border-radius: 8px; cursor: pointer; }
.views button.active { background: #2d6cdf; color: #fff; border-color: #2d6cdf; }
.period { display: flex; align-items: center; gap: .6rem; font-weight: 600; }

/* Calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head { font-weight: 600; text-align: center; padding: .3rem; color: #6b7280; }
.cal-cell { background: #fff; border: 1px solid #e4e7ec; border-radius: 8px; min-height: 92px; padding: 4px 6px; cursor: pointer; position: relative; }
.cal-cell .num { font-size: .8rem; color: #6b7280; }
.cal-cell.weekend { background: #eef1f5; }
.cal-cell.other-month { visibility: hidden; }
.cal-cell.AL { background: #e6f4ea; border-color: #2e7d46; }
.cal-cell.MC { background: #fff4e5; border-color: #d98324; }
.cal-cell.OFF { background: #eef; border-color: #5b6bd8; }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; padding: 0 4px; border-radius: 4px; }
.badge-AL { background: #2e7d46; color:#fff; } .badge-MC { background:#d98324; color:#fff; } .badge-OFF { background:#5b6bd8; color:#fff; }
.badge-HOL { background:#c0392b; color:#fff; } .badge-NOTE { background:#e4e7ec; color:#1f2430; }
.cell-tags { display:flex; flex-direction:column; align-items:flex-start; gap:2px; margin-top:2px; }
.cell-tags .tag { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cell-comment { font-size: .72rem; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.holiday-name { font-size: .68rem; color: #c0392b; }

/* Sidebar stats */
.stat { margin: .4rem 0; }
.stat .bar { height: 8px; background: #e4e7ec; border-radius: 4px; overflow: hidden; margin-top: 3px; }
.stat .bar > span { display:block; height: 100%; background: #2d6cdf; }
.sidebar h2 { font-size: 1rem; margin: 1rem 0 .3rem; }
.sidebar ul { list-style: none; padding: 0; margin: 0; font-size: .85rem; }
.sidebar li { padding: .2rem 0; border-bottom: 1px solid #f0f1f4; }

/* Year view */
.year-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.mini-month { background:#fff; border:1px solid #e4e7ec; border-radius:8px; padding:.5rem; }
.mini-grid { display:grid; grid-template-columns: repeat(7,1fr); gap:2px; }
.mini-cell { aspect-ratio:1; font-size:.6rem; display:flex; align-items:center; justify-content:center; border-radius:3px; }
.mini-cell.AL{background:#2e7d46;color:#fff;} .mini-cell.MC{background:#d98324;color:#fff;}
.mini-cell.OFF{background:#5b6bd8;color:#fff;} .mini-cell.holiday{background:#fdd;} .mini-cell.weekend{background:#eef1f5;}
.mini-cell.has-note{box-shadow:inset 0 -3px 0 #2d6cdf;}

/* Ledger + modal */
table.ledger { width:100%; border-collapse: collapse; background:#fff; }
table.ledger th, table.ledger td { text-align:left; padding:.5rem; border-bottom:1px solid #eee; font-size:.9rem; }
.modal-backdrop { position: fixed; inset:0; background: rgba(0,0,0,.4); display:flex; align-items:center; justify-content:center; }
.modal { background:#fff; padding:1.2rem; border-radius:10px; width:340px; }
.modal input, .modal select, .modal textarea, .modal button { width:100%; padding:.5rem; margin-top:.5rem; border-radius:6px; border:1px solid #d5d9e0; }
.modal .row { display:flex; gap:.5rem; }
.modal .row button { margin-top:.8rem; }
