:root {
  --brand: #27B199;
  --brand-dim: #1d8a78;
  --bg: #f5f4f0;
  --surface: #ffffff;
  --border: #e2e0da;
  --text: #1a1a18;
  --muted: #888680;
  --faint: #c8c6c0;
  --font: 'IBM Plex Sans', sans-serif;
  --mono: 'IBM Plex Mono', monospace;
  --ops-bg: #fff7ed;
  --ops-text: #9a3c00;
  --ops-border: #fdd9b5;
  --del-bg: #eef6ff;
  --del-text: #1a5fa8;
  --del-border: #bfdbfe;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }

#login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px; width: 100%; max-width: 360px; margin: 16px; }
.login-logo { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--brand); margin-bottom: 20px; }
.login-logo span { color: var(--muted); font-weight: 400; }
.login-box h2 { font-size: 18px; font-weight: 500; margin-bottom: 4px; }
.login-box p { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.member-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.member-chip { padding: 6px 14px; border-radius: 20px; font-size: 13px; cursor: pointer; border: 1px solid var(--border); background: transparent; color: var(--muted); transition: all 0.12s; font-family: var(--font); }
.member-chip:hover { border-color: var(--brand); color: var(--brand); }
.member-chip.selected { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 500; }
.login-or { font-size: 12px; color: var(--faint); text-align: center; margin: 12px 0; }
.login-row { display: flex; gap: 8px; }
.login-row input { flex: 1; font-size: 13px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font-family: var(--font); outline: none; }
.login-row input:focus { border-color: var(--brand); }

#app { display: none; }
.layout { display: flex; min-height: 100vh; }

.sidebar { width: 220px; min-width: 220px; border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; padding: 20px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-logo { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--brand); padding: 0 20px 20px; border-bottom: 1px solid var(--border); }
.sidebar-logo span { color: var(--muted); font-weight: 400; }
.sidebar-section { padding: 16px 20px 8px; font-size: 11px; font-weight: 500; color: var(--faint); letter-spacing: 0.08em; text-transform: uppercase; }
.week-btn { display: flex; align-items: center; gap: 10px; padding: 8px 20px; font-size: 13px; cursor: pointer; border: none; background: transparent; color: var(--muted); text-align: left; width: 100%; transition: all 0.12s; border-left: 2px solid transparent; }
.week-btn:hover { color: var(--text); background: var(--bg); }
.week-btn.active { color: var(--brand); border-left-color: var(--brand); background: #f0faf8; }
.week-btn .w-pct { font-family: var(--mono); font-size: 11px; color: var(--faint); margin-left: auto; }
.week-btn.active .w-pct { color: var(--brand); }

.scope-tabs { display: flex; gap: 4px; padding: 16px 20px 8px; }
.scope-tab { flex: 1; padding: 5px 4px; border-radius: 6px; border: 1px solid var(--border); font-size: 11px; font-weight: 500; cursor: pointer; background: transparent; color: var(--muted); transition: all 0.12s; text-align: center; }
.scope-tab:hover { background: var(--bg); }
.scope-tab.active-all { background: var(--text); color: #fff; border-color: var(--text); }
.scope-tab.active-ops { background: var(--ops-bg); color: var(--ops-text); border-color: var(--ops-border); }
.scope-tab.active-delivery { background: var(--del-bg); color: var(--del-text); border-color: var(--del-border); }

.sidebar-footer { margin-top: auto; padding: 16px 20px; border-top: 1px solid var(--border); }
.user-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.user-dot { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 500; color: #fff; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 500; }
.user-sub { font-size: 11px; color: var(--muted); }
.btn-switch-user { font-size: 12px; color: var(--muted); background: none; border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px; cursor: pointer; width: 100%; }
.btn-switch-user:hover { color: var(--text); }

.main { flex: 1; overflow-y: auto; }
.main-header { padding: 24px 32px 0; }
.main-header h1 { font-size: 20px; font-weight: 500; }
.main-header p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.global-progress { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.gbar-stack { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.gbar { width: 100%; height: 3px; background: var(--border); border-radius: 2px; }
.gbar-fill { height: 3px; background: var(--brand); border-radius: 2px; transition: width 0.4s; }
.gbar-team .gbar-fill { background: var(--faint); }
.gbar-label { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.content { padding: 24px 32px 48px; }

.day-header { display: flex; align-items: center; margin: 20px 0 8px; gap: 8px; }
.day-label { font-family: var(--mono); font-size: 11px; color: var(--faint); white-space: nowrap; }
.day-line { flex: 1; height: 1px; background: var(--border); }
.btn-add-task { font-size: 11px; font-weight: 500; color: var(--brand); background: none; border: 1px dashed var(--brand); border-radius: 5px; padding: 3px 10px; cursor: pointer; white-space: nowrap; opacity: 0.7; }
.btn-add-task:hover { opacity: 1; background: #f0faf8; }
.day-label.today { color: var(--brand); font-weight: 500; }
.today-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin-left: 5px; vertical-align: middle; margin-top: -1px; }
.day-line.today { background: var(--brand); opacity: 0.3; }

.task-list { display: flex; flex-direction: column; gap: 5px; }
.task-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-radius: 7px; border: 1px solid transparent; background: var(--bg); font-size: 13px; transition: all 0.12s; }
.task-item:hover { border-color: var(--border); background: var(--surface); }
.task-item:hover .task-actions { opacity: 1; }
.task-item.done { opacity: 1; }
.task-item.done .task-text { color: var(--text); }
.check { width: 16px; height: 16px; min-width: 16px; border-radius: 4px; border: 1.5px solid var(--faint); background: transparent; display: flex; align-items: center; justify-content: center; margin-top: 1px; cursor: pointer; transition: all 0.12s; flex-shrink: 0; }
.check.checked { border: none; }
.check svg { display: none; width: 10px; height: 10px; }
.check.checked svg { display: block; }
.task-body { flex: 1; min-width: 0; }
.task-text { line-height: 1.4; word-break: break-word; cursor: pointer; }
.task-meta { display: flex; align-items: center; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.scope-badge { font-size: 10px; padding: 2px 7px; border-radius: 4px; font-weight: 500; font-family: var(--mono); }
.scope-ops { background: var(--ops-bg); color: var(--ops-text); border: 1px solid var(--ops-border); }
.scope-delivery { background: var(--del-bg); color: var(--del-text); border: 1px solid var(--del-border); }
.tag { font-size: 10px; padding: 2px 7px; border-radius: 4px; font-weight: 500; white-space: nowrap; font-family: var(--mono); }
.tag-be { background: #dceeff; color: #1a5fa8; }
.tag-fe { background: #d4f5ec; color: #0d6e54; }
.tag-infra { background: #ede9fe; color: #5b3fc0; }
.checker-pill { font-size: 10px; padding: 2px 8px; border-radius: 4px; font-weight: 500; color: #fff; white-space: nowrap; font-family: var(--mono); }
.checker-date { font-size: 10px; color: var(--faint); font-family: var(--mono); }
.done-by { display: flex; align-items: center; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.done-by-label { font-size: 10px; color: var(--faint); font-family: var(--mono); }
.done-avatar { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 3px; border-radius: 20px; font-size: 10px; font-weight: 500; color: #fff; }
.done-avatar-dot { width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 8px; font-weight: 500; flex-shrink: 0; background: rgba(0,0,0,0.15); }
.task-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.1s; flex-shrink: 0; margin-top: 1px; }
.drag-handle { cursor: grab; color: var(--faint); display: flex; align-items: center; padding: 0 4px; flex-shrink: 0; user-select: none; }
.drag-handle:hover { color: var(--muted); }
.drag-handle:active { cursor: grabbing; }

/* Drag in progress */
.task-item.is-dragging { opacity: 0.25; }
.drop-indicator { height: 2px; background: var(--brand); border-radius: 2px; margin: 2px 0; pointer-events: none; flex-shrink: 0; }

/* Drop zone — visible when drag is active */
.day-drop-zone { min-height: 8px; border-radius: 6px; transition: background 0.1s, outline 0.1s; }
.dnd-active .day-drop-zone { min-height: 40px; outline: 1px dashed var(--border); background: rgba(0,0,0,0.01); }
.dnd-active .day-drop-zone.drop-active { outline: 1.5px dashed var(--brand); background: rgba(39,177,153,0.06); }
.btn-icon { background: none; border: 1px solid var(--border); border-radius: 5px; width: 26px; height: 26px; cursor: pointer; color: var(--muted); font-size: 12px; display: flex; align-items: center; justify-content: center; }
.btn-icon:hover { background: var(--surface); color: var(--text); }
.btn-icon.del:hover { border-color: #fca5a5; color: #dc2626; background: #fff5f5; }

.inline-form { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 7px; background: var(--surface); margin-top: 2px; }
.inline-form.editing { border: 1px solid var(--brand); }
.inline-form.adding { border: 1px dashed var(--brand); background: #f7fffe; }
.inline-form input[type=text] { font-size: 13px; font-family: var(--font); padding: 6px 8px; border: 1px solid var(--border); border-radius: 5px; background: var(--bg); color: var(--text); outline: none; width: 100%; }
.inline-form input[type=text]:focus { border-color: var(--brand); }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-select { font-size: 12px; font-family: var(--font); padding: 5px 8px; border: 1px solid var(--border); border-radius: 5px; background: var(--bg); color: var(--text); outline: none; cursor: pointer; }
.form-select:focus { border-color: var(--brand); }
.form-btns { display: flex; gap: 6px; margin-left: auto; }
.move-row { margin-top: 2px; padding-top: 8px; border-top: 1px dashed var(--border); }
.move-label { font-size: 11px; color: var(--muted); font-weight: 500; white-space: nowrap; align-self: center; }
.btn-save { padding: 5px 14px; background: var(--brand); color: #fff; border: none; border-radius: 5px; font-size: 12px; font-weight: 500; cursor: pointer; }
.btn-save:hover { background: var(--brand-dim); }
.btn-cancel-sm { padding: 5px 10px; background: none; border: 1px solid var(--border); border-radius: 5px; font-size: 12px; color: var(--muted); cursor: pointer; }
.btn-cancel-sm:hover { color: var(--text); }

.main-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.btn-export { font-size: 11px; font-weight: 500; font-family: var(--mono); color: var(--brand); background: none; border: 1px solid var(--brand); border-radius: 6px; padding: 5px 12px; cursor: pointer; white-space: nowrap; opacity: 0.8; flex-shrink: 0; margin-top: 2px; }
.btn-export:hover { opacity: 1; background: #f0faf8; }

.export-modal-inner { max-width: 560px; width: 100%; }
.export-options { margin-bottom: 12px; }
.export-option-label { font-size: 11px; font-weight: 500; color: var(--faint); letter-spacing: 0.07em; text-transform: uppercase; margin-bottom: 6px; }
.export-date-row { display: flex; align-items: center; gap: 10px; }
.export-date-field { display: flex; flex-direction: column; gap: 3px; }
.export-date-field label { font-size: 11px; color: var(--muted); }
.export-date-field input[type=date] { font-size: 12px; }
.export-date-sep { color: var(--faint); font-size: 14px; margin-top: 16px; }
.export-scope-row { display: flex; gap: 16px; }
.export-scope-row label { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); cursor: pointer; }
.export-preview { width: 100%; height: 220px; font-family: var(--mono); font-size: 11px; line-height: 1.6; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); resize: vertical; margin-bottom: 12px; outline: none; }
.export-preview:focus { border-color: var(--brand); }

.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 100; align-items: center; justify-content: center; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; width: 100%; max-width: 360px; margin: 16px; }
.modal h2 { font-size: 15px; font-weight: 500; margin-bottom: 8px; }
.modal p { font-size: 13px; color: var(--muted); margin-bottom: 20px; line-height: 1.5; }
.modal-btns { display: flex; gap: 8px; }
.btn-danger { padding: 8px 18px; background: #dc2626; color: #fff; border: none; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { padding: 8px 16px; background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; font-size: 13px; cursor: pointer; }
.btn-ghost:hover { color: var(--text); }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; font-size: 13px; padding: 8px 18px; border-radius: 20px; opacity: 0; transition: opacity 0.2s; pointer-events: none; white-space: nowrap; z-index: 200; }
#toast.show { opacity: 1; }
.loading { text-align: center; padding: 60px 20px; color: var(--muted); font-size: 13px; font-family: var(--mono); }

@media (max-width: 640px) {
  .sidebar { display: none; }
  .main-header { padding: 16px 16px 0; }
  .content { padding: 16px 16px 48px; }
}
