/* Taskboard — blue & green theme */
:root {
  --side-bg: #0B2545;
  --side-line: #183A63;
  --side-hover: #12335A;
  --side-active: #15406F;
  --side-text: #E3ECF7;
  --side-muted: #A3B6CE;

  --bg: #F3F6FA;
  --surface: #FFFFFF;
  --surface-2: #F7F9FC;
  --line: #DCE4EE;
  --text: #0F1B2D;
  --muted: #56677F;

  --blue: #1D4ED8;
  --blue-soft: #E5EDFF;
  --green: #15803D;
  --green-hover: #116A32;
  --green-bright: #22C55E;
  --green-soft: #DCF5E6;
  --red: #B42318;
  --red-soft: #FDE7E5;
  --amber: #A15C07;
  --amber-soft: #FEF0D7;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .06), 0 4px 16px rgba(15, 27, 45, .05);
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--blue); }
a:hover { color: #1E3A8A; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
.ico { flex-shrink: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 280px; flex-shrink: 0; background: var(--side-bg); color: var(--side-text);
  display: flex; flex-direction: column; gap: 18px; padding: 20px 16px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 18px 32px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 22px; font-weight: 700; flex: 1; min-width: 0; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.content { padding: 28px 32px 48px; max-width: 1280px; width: 100%; }
.menu-btn, .sidebar-close, .scrim { display: none; }

/* ---------- Sidebar ---------- */
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 4px 4px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; background: var(--green-bright); color: #052E16;
  display: flex; align-items: center; justify-content: center;
}
.brand-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.brand-text strong { font-size: 16px; }
.brand-text small { color: var(--side-muted); font-size: 12px; }

.side-search {
  display: flex; align-items: center; gap: 10px; padding: 0 12px; min-height: 44px;
  background: #0F2E52; border: 1px solid var(--side-line); border-radius: 10px; color: var(--side-muted);
}
.side-search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--side-text); font: inherit; font-size: 14px; }
.side-search input::placeholder { color: var(--side-muted); }
.side-search:focus-within { border-color: var(--green-bright); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px;
  color: #D2DEED; text-decoration: none; font-size: 14px; font-weight: 500;
}
.nav-link:hover { background: var(--side-hover); color: #fff; }
.nav-link.active { background: var(--side-active); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--green-bright); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--green-bright); color: #052E16; }

.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-section-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 4px 12px; }
.nav-section-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--side-muted); text-decoration: none; }
.nav-section-title:hover, .nav-section-title.on { color: #fff; }
.nav-project {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: 8px;
  color: #D2DEED; text-decoration: none; font-size: 14px;
}
.nav-project:hover { background: var(--side-hover); color: #fff; }
.nav-count { font-size: 12px; color: var(--side-muted); }
.nav-empty { color: var(--side-muted); font-size: 13px; margin: 0; padding: 4px 12px; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; display: inline-block; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.me-card {
  margin-top: 10px; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px;
  background: #0F2E52; border: 1px solid var(--side-line); border-radius: 12px;
}
.me-card form { margin: 0; }
.me-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.me-text strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text small { font-size: 12px; color: var(--side-muted); }
.avatar {
  width: 36px; height: 36px; border-radius: 999px; background: #2B5A92; color: #fff; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; background: var(--blue-soft); color: var(--blue); }

.icon-btn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent; color: inherit; cursor: pointer; text-decoration: none;
}
.sidebar .icon-btn { color: var(--side-muted); }
.sidebar .icon-btn:hover { background: var(--side-hover); color: #fff; }
.icon-btn.small { width: 28px; height: 28px; }
.main .icon-btn:hover { background: var(--surface-2); }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-hover); color: #fff; }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-blue:hover { background: #1E40AF; color: #fff; }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: var(--red-soft); color: var(--red); }
.btn-block { width: 100%; min-height: 44px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; }

.form-card { max-width: 760px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search].input, select, textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
  border: 1px solid #C9D4E2; border-radius: 10px; padding: 10px 12px; min-height: 42px; width: 100%;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.form-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.color-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.color-pick label { position: relative; cursor: pointer; }
.color-pick input { position: absolute; opacity: 0; }
.color-pick span { display: block; width: 32px; height: 32px; border-radius: 8px; border: 3px solid transparent; }
.color-pick input:checked + span { border-color: var(--text); }
.color-pick input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Cards / panels ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; }
.stack { display: flex; flex-direction: column; gap: 20px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.stat.blue .stat-label { color: var(--blue); }
.stat.green .stat-label { color: var(--green); }
.stat.red .stat-label { color: var(--red); }

/* ---------- Tables / lists ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #F9FBFE; }
.task-title { font-weight: 600; color: var(--text); text-decoration: none; }
.task-title:hover { color: var(--blue); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.overdue { color: var(--red); font-weight: 600; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions form { margin: 0; }

.task-list { list-style: none; margin: 0; padding: 0; }
.task-list li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.task-list li:last-child { border-bottom: 0; }
.task-list .grow { flex: 1; min-width: 0; }
.task-list .grow a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { padding: 36px 20px; text-align: center; color: var(--muted); }

.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.status-todo { background: #EAEFF5; color: #3E4F66; }
.status-in_progress { background: var(--blue-soft); color: var(--blue); }
.status-review { background: #E0F2F7; color: #0E6A80; }
.status-done { background: var(--green-soft); color: var(--green); }
.prio-low { background: #EEF1F5; color: #4A5A70; }
.prio-medium { background: var(--blue-soft); color: #1E40AF; }
.prio-high { background: var(--amber-soft); color: var(--amber); }
.prio-urgent { background: var(--red-soft); color: var(--red); }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.filters select, .filters input { width: auto; min-width: 150px; }
.filters .grow { flex: 1; min-width: 200px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: #E6ECF4; border-radius: 10px; width: fit-content; margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 600; }
.tabs a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Progress ---------- */
.progress { height: 8px; background: #E6ECF4; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.bar-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) 48px; gap: 12px; align-items: center; padding: 8px 0; font-size: 14px; }
.bar-row .bar { height: 12px; background: #E6ECF4; border-radius: 999px; overflow: hidden; }
.bar-row .bar span { display: block; height: 100%; border-radius: 999px; }

/* ---------- Projects ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.project-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; border-top: 4px solid var(--blue); }
.project-card h3 { font-size: 17px; }
.project-card h3 a { color: var(--text); text-decoration: none; }
.project-card h3 a:hover { color: var(--blue); }
.project-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }

/* ---------- Task detail ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.meta-list { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.meta-list dt { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.meta-list dd { margin: 4px 0 0; }
.description { white-space: pre-wrap; word-wrap: break-word; }
.comments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.comment { display: flex; gap: 12px; }
.comment-body { flex: 1; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.comment-body header { display: flex; gap: 8px; align-items: baseline; font-size: 13px; margin-bottom: 4px; }
.comment-body p { margin: 0; white-space: pre-wrap; word-wrap: break-word; }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.cal-head h2 { font-size: 18px; flex: 1; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-dow { padding: 10px; font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 116px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day.other { background: #FAFBFD; color: #94A3B8; }
.cal-day.today .cal-num { background: var(--blue); color: #fff; }
.cal-num { font-size: 13px; font-weight: 600; width: 26px; height: 26px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
.cal-task { display: block; font-size: 12px; padding: 3px 6px; border-radius: 6px; text-decoration: none; color: var(--text); background: var(--blue-soft); border-left: 3px solid var(--blue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-task.done { background: var(--green-soft); border-left-color: var(--green); color: var(--muted); text-decoration: line-through; }
.cal-more { font-size: 12px; color: var(--muted); }

/* ---------- Flash ---------- */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; font-weight: 500; transition: opacity .4s; }
.flash.fade { opacity: .0; pointer-events: none; height: 0; padding: 0; margin: 0; overflow: hidden; }
.flash-success { background: var(--green-soft); color: #0F5C2C; border: 1px solid #A7E3BF; }
.flash-error { background: var(--red-soft); color: #8A1C12; border: 1px solid #F5B5AE; }
.flash-info { background: var(--blue-soft); color: #1E3A8A; border: 1px solid #BFD0FB; }

/* ---------- Auth page ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-side { background: var(--side-bg); color: var(--side-text); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.auth-side h2 { font-size: 36px; line-height: 1.15; max-width: 420px; }
.auth-side p { color: var(--side-muted); max-width: 420px; }
.auth-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; gap: 10px; align-items: center; }
.auth-points .ico { color: var(--green-bright); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-box { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
.auth-box h1 { font-size: 28px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .detail-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .scrim { display: block; position: fixed; inset: 0; background: rgba(5, 15, 30, .5); z-index: 30; }
  .menu-btn, .sidebar-close { display: inline-flex; }
  .topbar { padding: 14px 16px; }
  .topbar h1 { font-size: 19px; }
  .content { padding: 20px 16px 40px; }
  .grid-2, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }
  .cal-day { min-height: 76px; padding: 4px; }
  .cal-task { font-size: 11px; padding: 2px 4px; }
  .bar-row { grid-template-columns: 100px minmax(0, 1fr) 40px; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .stat-value { font-size: 24px; }
  .filters select, .filters input { min-width: 0; flex: 1 1 140px; }
  .cal-dow { padding: 6px 2px; font-size: 10px; text-align: center; }
}
