/* ── Textla-inspired palette ──────────────────────────────────────────────
   Background : #f2f0d0  (warm cream)
   Surface    : #ffffff  (cards/panels)
   Surface-2  : #f7f5e4  (alt rows, subtle tint)
   Border     : #dddbb8  (cream-toned border)
   Dark       : #1a2e1a  (near-black green — topbar, headings)
   Mid-green  : #3d8b37  (accent green — labels, badges)
   Yellow     : #e8d44d  (primary CTA buttons)
   Muted      : #6b7a5e  (secondary text)
   Muted-2    : #9aaa88  (placeholder / meta)
── */
:root {
  --bg:         #f2f0d0;
  --surface:    #ffffff;
  --surface-2:  #f7f5e4;
  --border:     #dddbb8;
  --dark:       #1a2e1a;
  --green:      #3d8b37;
  --yellow:     #e8d44d;
  --muted:      #6b7a5e;
  --muted-2:    #9aaa88;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--dark); }

/* ── Auth screen ── */
.auth-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card { background: var(--surface); border-radius: 16px; padding: 48px; max-width: 440px; width: 100%; box-shadow: 0 4px 24px rgba(26,46,26,0.10); border: 1px solid var(--border); }
.auth-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 8px; color: var(--dark); }
.auth-card p  { color: var(--muted); font-size: 14px; margin-bottom: 24px; }
.auth-card input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 14px; outline: none; transition: border-color .2s; background: var(--surface-2); color: var(--dark); }
.auth-card input:focus { border-color: var(--green); }
.auth-card button { width: 100%; margin-top: 14px; padding: 12px; background: var(--yellow); color: var(--dark); border: none; border-radius: 10px; font-size: 15px; font-weight: 700; cursor: pointer; transition: background .2s; }
.auth-card button:hover { background: #d9c43a; }
.auth-card .hint { font-size: 12px; color: var(--muted-2); margin-top: 12px; text-align: center; }

/* ── App shell ── */
.app { min-height: 100vh; }
.topbar { background: var(--dark); border-bottom: none; padding: 0 32px; height: 60px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
.topbar h2 { font-size: 18px; font-weight: 700; color: #fff; }
.topbar-right { display: flex; gap: 10px; align-items: center; }
select { padding: 8px 12px; border: 1.5px solid rgba(255,255,255,0.2); border-radius: 8px; font-size: 14px; outline: none; background: rgba(255,255,255,0.08); color: #fff; cursor: pointer; }
select option { background: var(--dark); color: #fff; }
select:focus { border-color: var(--yellow); }
.btn-sm { padding: 8px 16px; background: var(--yellow); color: var(--dark); border: none; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; transition: background .2s; }
.btn-sm:hover { background: #d9c43a; }
.btn-ghost { padding: 8px 14px; background: transparent; color: var(--yellow); border: 1.5px solid var(--yellow); border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
.btn-ghost:hover { background: var(--yellow); color: var(--dark); }

/* ── Main content ── */
.main { padding: 32px; max-width: 1200px; margin: 0 auto; }

/* ── KPI cards ── */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.card { background: var(--surface); border-radius: 14px; padding: 24px; box-shadow: 0 1px 4px rgba(26,46,26,0.07); border: 1px solid var(--border); }
.card .label { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .4px; }
.card .value { font-size: 36px; font-weight: 800; line-height: 1; color: var(--dark); }

/* ── Panel ── */
.row2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 32px; }
.panel { background: var(--surface); border-radius: 14px; padding: 24px; box-shadow: 0 1px 4px rgba(26,46,26,0.07); border: 1px solid var(--border); }
.panel h3 { font-size: 15px; font-weight: 700; margin-bottom: 20px; color: var(--dark); }

/* ── Assignee list ── */
.assignee-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 14px; }
.assignee-row .name { flex: 1; }
.bar-track { flex: 2; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-fill  { height: 100%; background: var(--green); border-radius: 4px; transition: width .4s; }
.assignee-row .count { min-width: 28px; text-align: right; font-weight: 600; color: var(--muted); font-size: 13px; }

/* ── Task table ── */
.table-panel { background: var(--surface); border-radius: 14px; padding: 24px; box-shadow: 0 1px 4px rgba(26,46,26,0.07); border: 1px solid var(--border); }
.table-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.table-header h3 { font-size: 15px; font-weight: 700; }
.search-input { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; width: 220px; background: var(--surface-2); color: var(--dark); }
.search-input:focus { border-color: var(--green); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 10px 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1.5px solid var(--border); }
td { padding: 12px 12px; border-bottom: 1px solid var(--surface-2); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr.task-row { cursor: pointer; transition: background .15s; }
tr.task-row:hover { background: #eeecc4; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge.done     { background: #d4edcc; color: var(--green); }
.badge.overdue  { background: #fde8e8; color: #b83030; }
.badge.open     { background: #eef5cc; color: var(--dark); }

/* ── Story timeline ── */
.story-row td { padding: 0; }
.story-box { padding: 16px 24px 16px 48px; background: var(--surface-2); border-bottom: 1.5px solid var(--border); }
.story-box h4 { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 12px; }
.story-item { display: flex; gap: 12px; margin-bottom: 10px; font-size: 13px; }
.story-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-top: 4px; flex-shrink: 0; }
.story-meta { color: var(--muted-2); }
.story-text { color: var(--dark); }

/* ── Loading / empty states ── */
.loading { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--muted); font-size: 15px; }
.spinner { width: 20px; height: 20px; border: 2.5px solid var(--border); border-top-color: var(--green); border-radius: 50%; animation: spin .7s linear infinite; margin-right: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-msg { background: #fde8e8; color: #b83030; padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 20px; border: 1px solid #f5c6c6; }

/* ── Column filters ── */
.colhead { display: flex; align-items: center; gap: 5px; min-width: 0; }
.colhead .lbl { font-size: 11px; font-weight: 700; color: #6b7a5e; text-transform: uppercase; letter-spacing: .4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filt-btn { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: none; border-radius: 5px; background: transparent; color: #9aaa88; cursor: pointer; font-size: 10px; line-height: 1; padding: 0; transition: background .15s, color .15s; }
.filt-btn:hover { background: #e3e1bc; color: #6b7a5e; }
.filt-btn.active { background: var(--green, #4a7a3a); color: #fff; }
.filt-pop { position: fixed; z-index: 1000; background: #fff; border: 1px solid #dddbb8; border-radius: 10px; box-shadow: 0 6px 24px rgba(26,46,26,0.18); padding: 8px; width: 230px; max-height: 320px; display: flex; flex-direction: column; }
.filt-pop .filt-search { width: 100%; padding: 6px 8px; border: 1.5px solid #dddbb8; border-radius: 7px; font-size: 13px; outline: none; margin-bottom: 6px; box-sizing: border-box; background: #f7f5e4; color: #1a2e1a; }
.filt-pop .filt-search:focus { border-color: var(--green, #4a7a3a); }
.filt-pop .filt-actions { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.filt-pop .filt-actions button { flex: 1; padding: 4px 6px; border: 1px solid #dddbb8; border-radius: 6px; background: #f7f5e4; color: #6b7a5e; font-size: 11px; font-weight: 600; cursor: pointer; }
.filt-pop .filt-actions button:hover { background: #eeecc4; }
.filt-list { overflow-y: auto; flex: 1; }
.filt-opt { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 13px; color: #1a2e1a; }
.filt-opt:hover { background: #f3f1da; }
.filt-opt input { margin: 0; cursor: pointer; accent-color: var(--green, #4a7a3a); }
.filt-opt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filt-empty { font-size: 12px; color: #9aaa88; padding: 8px 6px; text-align: center; }

@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .row2  { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .cards { grid-template-columns: 1fr 1fr; }
  .main  { padding: 16px; }
}
