/* APPL Team Productivity — interface styles.
   Leaf green structure, cool canvas, mango reserved for "needs attention" and the day timeline. */
:root {
  --leaf: #1f4d3a; --leaf-2: #2b6650; --leaf-3: #e6efe9; --canvas: #f5f7f6; --surface: #ffffff;
  --ink: #1b2420; --muted: #5f6b66; --line: #dde3e0; --line-2: #eef1ef;
  --mango: #e39a1b; --mango-ink: #8a5a06; --mango-soft: #fdf1dc;
  --danger: #b42318; --danger-soft: #fdecea; --ok: #2e7d4f; --ok-soft: #e5f3ea; --info: #2f5d8a; --info-soft: #e7eef6;
  --violet: #5b4a9e; --violet-soft: #eeebf8;
  --radius: 6px; --sidebar-w: 224px; --topbar-h: 52px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}
html { font-size: 14px; }
body { font-family: var(--font); background: var(--canvas); color: var(--ink); line-height: 1.45; }
a { color: var(--leaf-2); }
a:hover { color: var(--leaf); }
:focus-visible { outline: 2px solid var(--mango); outline-offset: 2px; }
.visually-hidden-focusable:focus { position: fixed; top: 8px; left: 8px; z-index: 2000; background: #fff; padding: 8px 12px; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--leaf); color: #dfe9e3; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; transition: width .15s ease; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; height: var(--topbar-h); border-bottom: 1px solid rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 50% 50% 50% 8px; background: var(--mango); display: grid; place-items: center; color: var(--leaf); font-weight: 700; font-size: 13px; flex-shrink: 0; }
.brand-text { font-weight: 600; font-size: 13px; line-height: 1.15; }
.brand-text small { display: block; font-weight: 400; color: #a9c3b5; font-size: 11px; }
.nav-group { padding: 10px 8px 4px; }
.nav-group-title { font-size: 11px; color: #8fb09f; padding: 4px 10px; }
.sidebar .nav-link { display: flex; align-items: center; gap: 10px; color: #dfe9e3; padding: 7px 10px; border-radius: var(--radius); font-size: 13.5px; text-decoration: none; }
.sidebar .nav-link i { font-size: 15px; width: 18px; text-align: center; opacity: .9; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar .nav-link.active { background: var(--leaf-2); color: #fff; box-shadow: inset 3px 0 0 var(--mango); }
.sidebar .nav-link .count { margin-left: auto; background: var(--mango); color: var(--leaf); border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 700; }
body.sb-collapsed .sidebar { width: 60px; }
body.sb-collapsed .sidebar .brand-text, body.sb-collapsed .sidebar .nav-label, body.sb-collapsed .nav-group-title, body.sb-collapsed .sidebar .count { display: none; }
body.sb-collapsed .sidebar .nav-link { justify-content: center; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 18px; position: sticky; top: 0; z-index: 100; }
.topbar .search { flex: 1; max-width: 420px; }
.topbar .search input { background: var(--canvas); border-color: var(--line); font-size: 13px; }
.icon-btn { border: 1px solid transparent; background: none; padding: 6px 8px; border-radius: var(--radius); color: var(--muted); position: relative; line-height: 1; }
.icon-btn:hover { background: var(--canvas); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 2px; right: 1px; background: var(--danger); color: #fff; font-size: 10px; border-radius: 8px; padding: 1px 5px; font-weight: 600; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); text-decoration: none; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--leaf-3); color: var(--leaf); display: inline-grid; place-items: center; font-weight: 600; font-size: 11px; flex-shrink: 0; }
.content { padding: 18px 22px 40px; max-width: 1480px; width: 100%; }

/* Page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.36rem; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.crumbs a { color: var(--muted); }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.panel-head h2 { font-size: 14px; font-weight: 600; margin: 0; }
.panel-head .hint { font-size: 12px; color: var(--muted); }
.panel-body { padding: 14px; }
.panel-body.tight { padding: 0; }

/* KPI strip: one row of figures separated by rules rather than a card grid */
.kpis { display: flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.kpi { flex: 1 1 128px; min-width: 128px; padding: 12px 14px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); text-decoration: none; color: inherit; display: block; }
.kpi:hover { background: #fafcfb; }
.kpi .v { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi .s { font-size: 11.5px; color: var(--muted); }
.kpi.attn .v { color: var(--mango-ink); }
.kpi.attn { box-shadow: inset 3px 0 0 var(--mango); }
.kpi.bad .v { color: var(--danger); }
.kpi.bad { box-shadow: inset 3px 0 0 var(--danger); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { font-weight: 600; color: var(--muted); font-size: 12px; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #fafbfa; white-space: nowrap; position: sticky; top: 0; }
table.data th a { color: inherit; text-decoration: none; }
table.data td { padding: 7px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.data tr:hover td { background: #fafcfb; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .muted { color: var(--muted); }
.t-title { font-weight: 500; color: var(--ink); text-decoration: none; }
.t-title:hover { text-decoration: underline; }
.t-num { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Badges */
.badge-st { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.st-assigned { background: #eef1ef; color: #44514b; }
.st-accepted { background: var(--info-soft); color: var(--info); }
.st-wip { background: #e3f0ff; color: #1d5fa8; }
.st-blocked { background: var(--danger-soft); color: var(--danger); }
.st-review { background: var(--violet-soft); color: var(--violet); }
.st-changes { background: var(--mango-soft); color: var(--mango-ink); }
.st-closed { background: var(--ok-soft); color: var(--ok); }
.st-cancelled { background: #f1f1f1; color: #7a7a7a; text-decoration: line-through; }
.st-overdue { background: var(--danger); color: #fff; }
.st-risk { background: var(--mango-soft); color: var(--mango-ink); }
.pri { font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pri::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.pri-critical { color: var(--danger); } .pri-critical::before { background: var(--danger); }
.pri-high { color: #b45309; } .pri-high::before { background: var(--mango); }
.pri-medium { color: var(--info); } .pri-medium::before { background: var(--info); }
.pri-low { color: var(--muted); } .pri-low::before { background: #a7b2ad; }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--line-2); color: var(--muted); }
.tag-mango { background: var(--mango-soft); color: var(--mango-ink); }

/* Forms */
.form-label { font-size: 12.5px; font-weight: 600; color: #34413b; margin-bottom: 3px; }
.form-control, .form-select { font-size: 13.5px; border-color: #cfd8d3; }
.form-control:focus, .form-select:focus { border-color: var(--leaf-2); box-shadow: 0 0 0 .18rem rgba(43,102,80,.15); }
.form-text { font-size: 12px; }
.btn { font-size: 13px; border-radius: var(--radius); }
.btn-primary { background: var(--leaf); border-color: var(--leaf); }
.btn-primary:hover, .btn-primary:focus { background: var(--leaf-2); border-color: var(--leaf-2); }
.btn-outline-primary { color: var(--leaf); border-color: var(--leaf-2); }
.btn-outline-primary:hover { background: var(--leaf); border-color: var(--leaf); }
.btn-attn { background: var(--mango); border-color: var(--mango); color: #2b1d02; font-weight: 600; }
.btn-attn:hover { background: #cf8a12; border-color: #cf8a12; color: #2b1d02; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 10px 14px; border-bottom: 1px solid var(--line-2); background: #fbfcfb; }
.filters .form-control, .filters .form-select { font-size: 13px; padding: 4px 8px; height: 32px; }
.filters label { font-size: 11.5px; color: var(--muted); display: block; margin-bottom: 1px; }
.req::after { content: " *"; color: var(--danger); }

/* Empty states and alerts */
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty i { font-size: 26px; display: block; margin-bottom: 6px; color: #a7b2ad; }
.empty .btn { margin-top: 8px; }
.alert { font-size: 13.5px; border-radius: var(--radius); padding: 10px 14px; }
.flash-stack { margin-bottom: 12px; }

/* Day timeline — the signature component */
.timeline { position: relative; padding: 4px 0 0; }
.tl-scale { position: relative; height: 18px; margin-left: 74px; border-bottom: 1px solid var(--line); }
.tl-scale span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-row { display: flex; align-items: center; height: 34px; }
.tl-row .tl-label { width: 74px; font-size: 11.5px; color: var(--muted); flex-shrink: 0; }
.tl-track { position: relative; flex: 1; height: 26px; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(var(--slot) - 1px), var(--line-2) calc(var(--slot) - 1px), var(--line-2) var(--slot)); border-radius: 4px; }
.tl-block { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; font-size: 11px; padding: 2px 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #fff; text-decoration: none; min-width: 3px; }
.tl-plan .tl-block { background: #fff; border: 1.5px dashed var(--leaf-2); color: var(--leaf); }
.tl-actual .tl-block { background: var(--leaf-2); }
.tl-block.c-meeting { background: var(--info); } .tl-plan .tl-block.c-meeting { border-color: var(--info); color: var(--info); background: #fff; }
.tl-block.c-urgent { background: var(--danger); } .tl-plan .tl-block.c-urgent { border-color: var(--danger); color: var(--danger); background: #fff; }
.tl-block.c-routine { background: #3f7f65; }
.tl-block.c-training, .tl-block.c-reporting, .tl-block.c-coordination { background: var(--violet); }
.tl-block.c-other { background: #6b7570; }
/* Planned row is always an outline, whatever the category colour */
.tl-plan .tl-block[class*="c-"] { background: #fff; border: 1.5px dashed var(--leaf-2); color: var(--leaf); }
.tl-plan .tl-block.c-meeting { border-color: var(--info); color: var(--info); }
.tl-plan .tl-block.c-urgent { border-color: var(--danger); color: var(--danger); }
.tl-plan .tl-block.c-training, .tl-plan .tl-block.c-reporting, .tl-plan .tl-block.c-coordination { border-color: var(--violet); color: var(--violet); }
.tl-block.c-break, .tl-plan .tl-block.c-break { background: repeating-linear-gradient(45deg, #eef1ef 0 5px, #e3e8e5 5px 10px); color: var(--muted); border: none; }
.tl-break { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, rgba(95,107,102,.08) 0 4px, transparent 4px 8px); border-left: 1px dotted #b8c2bd; border-right: 1px dotted #b8c2bd; }
.tl-now { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--mango); z-index: 3; }
.tl-now::before { content: ""; position: absolute; top: -3px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--mango); }
.tl-gap { position: absolute; top: 3px; bottom: 3px; background: var(--mango-soft); border: 1px solid #f4d9a6; border-radius: 4px; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: var(--muted); margin: 8px 0 0 74px; }
.tl-legend i { display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.day-meter { display: flex; gap: 22px; flex-wrap: wrap; font-size: 13px; }
.day-meter > div { margin-right: 6px; }
.day-meter div b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.day-meter div span { color: var(--muted); font-size: 12px; }
.day-meter .gap b { color: var(--mango-ink); }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.k-col { background: #eef2f0; border-radius: var(--radius); padding: 8px; min-height: 120px; }
.k-col h3 { font-size: 12.5px; font-weight: 600; margin: 2px 4px 8px; display: flex; justify-content: space-between; color: #34413b; }
.k-card { background: #fff; border: 1px solid var(--line); border-radius: 5px; padding: 8px 9px; margin-bottom: 7px; display: block; color: inherit; text-decoration: none; font-size: 12.5px; }
.k-card:hover { border-color: var(--leaf-2); }
.k-card.overdue { border-left: 3px solid var(--danger); }
.k-card .meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; margin-top: 4px; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.cal .dow { background: #fafbfa; font-size: 11.5px; color: var(--muted); padding: 5px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-weight: 600; }
.cal .cell { min-height: 96px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 6px; font-size: 12px; background: #fff; }
.cal .cell.out { background: #fafbfa; color: #a7b2ad; }
.cal .cell.today { box-shadow: inset 0 3px 0 var(--mango); }
.cal .cell .d { font-weight: 600; font-size: 11.5px; color: var(--muted); }
.cal .ev { display: block; padding: 1px 5px; margin-top: 2px; border-radius: 3px; background: var(--leaf-3); color: var(--leaf); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
.cal .ev.overdue { background: var(--danger-soft); color: var(--danger); }
.cal .ev.done { background: #f1f1f1; color: #7a7a7a; }

/* Task detail */
.facts { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; font-size: 13px; }
.wl-name { white-space: nowrap; }
.facts dt { color: var(--muted); font-weight: 500; }
.facts dd { margin: 0; }
.history { list-style: none; padding: 0; margin: 0; font-size: 12.5px; }
.history li { padding: 7px 0 7px 16px; border-left: 2px solid var(--line); position: relative; }
.history li::before { content: ""; position: absolute; left: -5px; top: 12px; width: 8px; height: 8px; background: #fff; border: 2px solid var(--leaf-2); border-radius: 50%; }
.history .when { color: var(--muted); font-size: 11.5px; }
.comment { border-bottom: 1px solid var(--line-2); padding: 9px 0; font-size: 13px; }
.comment.mgr { background: var(--mango-soft); padding: 9px 10px; border-radius: 4px; border: none; margin: 6px 0; }
.comment .who { font-weight: 600; font-size: 12.5px; }
.comment .when { color: var(--muted); font-size: 11.5px; margin-left: 6px; }
.prewrap { white-space: pre-wrap; word-break: break-word; }
.progress { height: 6px; background: var(--line-2); }
.progress-bar { background: var(--leaf-2); }

/* Plan & checklist */
.plan-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.plan-item.locked { border-left: 3px solid var(--leaf-2); }
.plan-item .src { font-size: 11px; font-weight: 600; color: var(--leaf-2); }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.check-row:last-child { border-bottom: none; }
.check-row .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #b8c2bd; flex-shrink: 0; display: grid; place-items: center; font-size: 12px; margin-top: 1px; }
.check-row .tick.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-row .tick.pending { border-color: var(--violet); color: var(--violet); }
.check-row .tick.late { border-color: var(--mango); color: var(--mango-ink); }

.notif { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); text-decoration: none; color: inherit; }
.notif.unread { background: #fbfdfc; box-shadow: inset 3px 0 0 var(--mango); }
.notif .t { font-weight: 500; font-size: 13px; }
.notif .m { font-size: 12.5px; color: var(--muted); }
.notif .when { font-size: 11.5px; color: var(--muted); white-space: nowrap; margin-left: auto; }
.chart-box { position: relative; height: 240px; }
.def { font-size: 12px; color: var(--muted); }
.def dt { color: var(--ink); font-weight: 600; margin-top: 6px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; flex-wrap: wrap; }
.pager-meta { font-size: 12px; color: var(--muted); padding: 8px 14px; }
.pager .pager-meta { padding: 0; }
.page-link { color: var(--leaf); }
.active > .page-link, .page-link.active { background: var(--leaf); border-color: var(--leaf); }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--leaf); }
.auth-card { width: 100%; max-width: 380px; background: #fff; border-radius: 8px; padding: 28px; }
.auth-card .brand-mark { width: 38px; height: 38px; font-size: 16px; }

@media (max-width: 991px) {
  .sidebar { position: fixed; left: 0; z-index: 1040; transform: translateX(-100%); transition: transform .18s ease; width: var(--sidebar-w) !important; }
  body.sb-open .sidebar { transform: none; }
  body.sb-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 1030; }
  body.sb-collapsed .sidebar .brand-text, body.sb-collapsed .sidebar .nav-label, body.sb-collapsed .nav-group-title { display: initial; }
  .content { padding: 14px 12px 32px; }
  .topbar { padding: 0 10px; }
  .facts { grid-template-columns: 100px 1fr; }
  .kanban { grid-template-columns: repeat(6, 82%); }
  .tl-row .tl-label, .tl-legend { margin-left: 0; }
  .tl-scale { margin-left: 74px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .sidebar, .topbar, .no-print { display: none !important; } .content { padding: 0; } }
