:root {
  --bg: #0f1416;
  --panel: #151c1f;
  --panel2: #1a2327;
  --line: #243136;
  --text: #d6dfe2;
  --muted: #869aa1;
  --accent: #7cc4b2;
  --accent-dim: #2b4a44;
  --danger: #d98b84;
  --warn: #d9b77c;
  --info: #8fb3d9;
  --radius: 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }
label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }
.btn {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent-dim); border-color: var(--accent); color: #e6f4f0; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 5px 8px; }
.btn.ghost:hover { color: var(--text); border-color: var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* login */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 20px; }
.login { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login h1 { margin: 0 0 4px; font-size: 22px; }
.login .btn { width: 100%; justify-content: center; margin-top: 18px; padding: 10px; }
.err { color: var(--danger); margin-top: 10px; min-height: 18px; }

/* shell */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; }
.brand { font-weight: 700; font-size: 17px; padding: 4px 10px 18px; display: flex; gap: 8px; align-items: center; }
.brand img { width: 22px; height: 22px; }
.nav a { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px; color: var(--muted); }
.nav a:hover { color: var(--text); background: var(--panel2); }
.nav a.active { color: var(--text); background: var(--accent-dim); }
.side .me { margin-top: auto; padding: 10px; border-top: 1px solid var(--line); }
.main { padding: 24px 28px; min-width: 0; }
.main h2 { margin: 0 0 18px; font-size: 20px; display: flex; align-items: center; gap: 12px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input, .toolbar select { width: auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12px; margin-top: 2px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card h3 { margin: 0 0 12px; font-size: 14px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* tasks */
.board { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 140px; }
.col.over { border-color: var(--accent); }
.col-h { display: flex; justify-content: space-between; padding: 4px 6px 10px; font-weight: 600; }
.col-h .cnt { color: var(--muted); font-weight: 400; }
.tcard { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.tcard:hover { border-color: #35484f; }
.tcard.dragging { opacity: .4; }
.tcard .t { font-weight: 500; margin-bottom: 8px; word-break: break-word; }
.tcard .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 20px; border: 1px solid var(--line); color: var(--muted); }
.p-urgent { color: var(--danger); border-color: #5a3a37; }
.p-high { color: var(--warn); border-color: #554a33; }
.p-medium { color: var(--info); border-color: #354559; }
.p-low { color: var(--muted); }
.s-todo { color: var(--muted); }
.s-in_progress { color: var(--info); border-color: #354559; }
.s-review { color: var(--warn); border-color: #554a33; }
.s-done { color: var(--accent); border-color: var(--accent-dim); }
.overdue { color: var(--danger); }
.avatar { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-dim); color: #e6f4f0; display: inline-grid; place-items: center; font-size: 10px; font-weight: 700; flex: none; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel2); }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.list-item { display: flex; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--panel2); }

/* files */
.crumbs { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; font-size: 15px; }
.crumbs a { padding: 2px 6px; border-radius: 6px; }
.crumbs a:hover { background: var(--panel2); }
.drop { position: relative; }
.drop.over::after { content: "Drop files to upload"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(15,20,22,.85); border: 2px dashed var(--accent); border-radius: var(--radius); color: var(--accent); font-size: 18px; }
.fname { display: flex; align-items: center; gap: 10px; word-break: break-all; }
.ficon { width: 20px; text-align: center; flex: none; }
.acts { white-space: nowrap; text-align: right; }
.usage { font-size: 12px; color: var(--muted); }

/* modal */
.backdrop { position: fixed; inset: 0; background: rgba(5,8,9,.7); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: 100%; max-width: 640px; max-height: calc(100vh - 40px); overflow: auto; padding: 22px; }
.modal.wide { max-width: 1100px; height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal h3 { margin: 0 0 6px; font-size: 18px; }
.modal .foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.editor { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.55; resize: none; min-height: 0; tab-size: 2; }
.preview { flex: 1; min-height: 0; display: grid; place-items: center; overflow: auto; background: var(--bg); border-radius: 8px; }
.preview img, .preview video { max-width: 100%; max-height: 100%; }
.preview iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.preview pre { white-space: pre-wrap; padding: 16px; margin: 0; align-self: start; width: 100%; }
.section { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.section h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.comment { padding: 8px 0; border-bottom: 1px solid var(--line); }
.comment .who { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.comment .body { white-space: pre-wrap; word-break: break-word; }
.dot { color: var(--warn); }

/* toasts */
#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 14px; min-width: 220px; max-width: 360px; }
.toast.error { border-left-color: var(--danger); }
.progress { height: 4px; background: var(--line); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .15s; }

.menu-btn { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .main { padding: 16px; }
  .cols2, .grid2 { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(4, 80vw); }
  .hide-sm { display: none; }
}
.main h2 .btn { font-size: 14px; font-weight: 500; }
