:root {
  --bg: #f4f6fa; --surface: #fff; --ink: #1b2333; --muted: #667085; --line: #e3e7ee;
  --brand: #1f4fd8; --brand-ink: #fff; --brand-soft: #e8eefc; --side: #111a33; --side-ink: #b9c3dd;
  --ok: #157347; --ok-soft: #e3f4ea; --warn: #9a6700; --warn-soft: #fff4d6; --bad: #b42318; --bad-soft: #fde8e6;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.45; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; } h2 { font-size: 1.1rem; margin: 0 0 .75rem; } h3 { font-size: 1rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: var(--side-ink); padding: 1.1rem .8rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { color: #fff; font-weight: 700; font-size: 1.1rem; padding: .2rem .6rem 1rem; letter-spacing: .2px; }
.nav a { display: block; color: var(--side-ink); padding: .5rem .7rem; border-radius: 8px; margin-bottom: 2px; }
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.nav a.active { background: var(--brand); color: #fff; }
.nav .sep { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; padding: .9rem .7rem .3rem; color: #7d89ab; }
.userbox { margin-top: 1.2rem; padding: .8rem .7rem; border-top: 1px solid rgba(255,255,255,.1); font-size: .85rem; }
.userbox form { margin-top: .4rem; }
.main { padding: 1.5rem 2rem 3rem; max-width: 1280px; width: 100%; min-width: 0; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.pagehead .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; } .cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .cols-3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.stat { display: block; color: inherit; } .stat:hover { text-decoration: none; border-color: var(--brand); }
.stat .n { font-size: 1.9rem; font-weight: 700; line-height: 1.1; } .stat .l { color: var(--muted); font-size: .85rem; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; } .table tbody tr:hover { background: #fafbfd; }
.tablewrap { overflow-x: auto; }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 600; background: #eceff5; color: #3b455c; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); } .badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.blue { background: var(--brand-soft); color: var(--brand); }
.btn { display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: .5rem .9rem; border-radius: 8px; font-size: .9rem; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn:hover { text-decoration: none; border-color: #c9d0dd; background: #f8f9fc; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); } .btn.primary:hover { background: #1a43b8; }
.btn.danger { color: var(--bad); border-color: #f1c4bf; } .btn.danger:hover { background: var(--bad-soft); }
.btn.sm { padding: .25rem .6rem; font-size: .8rem; } .btn.link { border: 0; background: none; padding: 0; color: var(--brand); font-weight: 500; }
.side-btn { background: none; border: 1px solid rgba(255,255,255,.2); color: var(--side-ink); }
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; background: var(--ok-soft); color: var(--ok); }
.flash.warn { background: var(--warn-soft); color: var(--warn); } .flash.err { background: var(--bad-soft); color: var(--bad); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .9rem 1.1rem; } .form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .25rem; } .req { color: var(--bad); margin-left: 2px; }
.field input, .field select, .field textarea { width: 100%; padding: .55rem .65rem; border: 1px solid #ccd3df; border-radius: 8px; font: inherit; background: #fff; color: var(--ink); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.field .err { color: var(--bad); font-size: .8rem; margin: .2rem 0 0; } .field .hint { color: var(--muted); font-size: .8rem; margin: .2rem 0 0; }
.check { display: flex; align-items: center; gap: .5rem; padding-top: 1.4rem; } .check input { width: auto; } .check label { margin: 0; font-weight: 500; }
.formactions { margin-top: 1.2rem; display: flex; gap: .6rem; }
.toolbar { display: flex; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { padding: .45rem .6rem; border: 1px solid #ccd3df; border-radius: 8px; font: inherit; }
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .5rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs a.active { color: var(--brand); border-color: var(--brand); } .tabs a:hover { text-decoration: none; color: var(--ink); }
.dl { display: grid; grid-template-columns: 170px 1fr; gap: .35rem 1rem; margin: 0; } .dl dt { color: var(--muted); } .dl dd { margin: 0; }
.empty { color: var(--muted); padding: 1.2rem; text-align: center; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login .card { width: 100%; max-width: 400px; padding: 1.6rem; } .login .field { margin-bottom: .9rem; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #f1f3f8; padding: .35rem .5rem; border-radius: 6px; word-break: break-all; display: inline-block; }
.pwbox { display: none; margin-top: .4rem; padding: .7rem; background: #f7f9fd; border: 1px dashed #c9d3ea; border-radius: 8px; }
.pwbox.open { display: block; } .pwbox .row { display: flex; gap: .5rem; align-items: center; margin-bottom: .3rem; flex-wrap: wrap; } .pwbox .k { width: 110px; color: var(--muted); font-size: .8rem; }
.prog { height: 8px; background: #e8ebf2; border-radius: 99px; overflow: hidden; min-width: 90px; } .prog > i { display: block; height: 100%; background: var(--brand); }
.gantt { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow-x: auto; }
.gantt-head, .gantt-row { display: grid; grid-template-columns: 230px 1fr; min-width: 720px; }
.gantt-head { background: #f7f8fb; border-bottom: 1px solid var(--line); font-size: .75rem; color: var(--muted); }
.gantt-head .months { position: relative; height: 28px; } .gantt-head .months span { position: absolute; top: 6px; border-left: 1px solid var(--line); padding-left: 4px; height: 22px; }
.gantt-row { border-bottom: 1px solid var(--line); } .gantt-row:last-child { border-bottom: 0; }
.gantt-label { padding: .5rem .7rem; font-size: .85rem; border-right: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-track { position: relative; height: 38px; }
.gantt-tick { position: absolute; top: 0; bottom: 0; width: 1px; background: #eef0f5; }
.gantt-bar { position: absolute; top: 9px; height: 20px; border-radius: 5px; background: var(--brand); opacity: .9; min-width: 6px; }
.gantt-bar.done { background: #6aa084; } .gantt-bar.milestone { width: 14px !important; min-width: 14px; height: 14px; top: 12px; transform: rotate(45deg); border-radius: 2px; background: #b45309; }
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: #e11d48; opacity: .7; }
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; } .cal th { font-size: .75rem; color: var(--muted); padding: .3rem; text-align: left; }
.cal td { border: 1px solid var(--line); height: 100px; vertical-align: top; padding: .25rem .35rem; font-size: .8rem; background: #fff; } .cal td.other { background: #f7f8fb; color: #98a1b3; }
.cal td.today { outline: 2px solid var(--brand); outline-offset: -2px; } .cal .d { font-weight: 700; } .cal .ev { display: block; background: var(--brand-soft); color: var(--brand); border-radius: 4px; padding: 1px 4px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); } .sidebar { position: static; height: auto; } .nav { display: none; } .nav.open { display: block; }
  .menu-toggle { display: inline-block; float: right; background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 6px; padding: .2rem .6rem; }
  .main { padding: 1rem; } .cols-2, .cols-3, .cols-4, .form-grid { grid-template-columns: 1fr; } .dl { grid-template-columns: 1fr; } .cal td { height: 64px; }
}
