/* Task Portal — mobile-first UI. Brand colour comes from Settings via --brand. */
:root {
  --brand: #2563eb;
  --brand-soft: color-mix(in srgb, var(--brand) 10%, #fff);
  --brand-line: color-mix(in srgb, var(--brand) 30%, #fff);
  --bg: #f4f5f7;
  --surface: #fff;
  --surface-2: #f8f9fb;
  --border: #e6e8ec;
  --text: #14161a;
  --text-2: #3d424b;
  --muted: #6b7280;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #16a34a;
  --purple: #7c3aed;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --sidebar: 250px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
h4 { font-size: 14px; margin-bottom: 6px; }
p { margin: 0 0 10px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95em; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; border: 1px solid var(--border); }
small { font-size: 12px; }

.ico { width: 18px; height: 18px; flex: none; }
.ico-sm { width: 14px; height: 14px; }
.ico-lg { width: 40px; height: 40px; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 700; }
.center { text-align: center; }
.text-danger { color: var(--danger); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 14px; padding: 18px 14px; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 16px; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 9px; object-fit: contain; background: var(--surface-2); }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--brand); color: #fff; font-size: 14px; flex: none; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 600; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.nav .nav-wa { margin-top: 8px; border: 1px dashed var(--border); }
.nav .nav-wa .ico-sm { margin-left: auto; color: var(--muted); }
.nav .nav-wa > .ico:first-child { color: #16a34a; }
.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar-user .me { flex: 1; display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; padding: 6px; border-radius: var(--radius-sm); }
.sidebar-user .me:hover, .sidebar-user .me.active { background: var(--surface-2); text-decoration: none; }
.sidebar-user .me span { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user strong, .sidebar-user small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user small { color: var(--muted); }
.new-task { margin-top: 4px; }

.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid transparent; }
.topbar h1 { font-size: 20px; font-weight: 800; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.content { padding: 8px 28px 40px; max-width: 1280px; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); }
.only-mobile { display: none !important; }
.scrim { display: none; }
.bottom-nav { display: none; }

/* ---------- Cards & layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card > h3 { margin-bottom: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 460px; }
.card.narrow-lg { max-width: 760px; }
.card.highlight { border-color: var(--brand-line); background: var(--brand-soft); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .card, .grid-2 > div > .card:last-child { margin-bottom: 0; }
.grid-2 { margin-bottom: 16px; }
.grid-2.tight { gap: 24px; margin: 0; }
.grid-side { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-side-r { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.back { display: inline-block; margin-bottom: 12px; color: var(--muted); font-weight: 600; font-size: 13px; }

.empty { text-align: center; padding: 40px 20px; }
.empty h3 { justify-content: center; margin: 10px 0 6px; font-size: 17px; }
.empty p { color: var(--muted); }
.empty-sm { color: var(--muted); padding: 14px 0; margin: 0; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap; line-height: 1.2; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 88%, #000); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-text { color: var(--danger) !important; }
.btn-wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn-wa:hover { background: #1fb457; }
.btn-kudos { background: #fdf2f8; border-color: #fbcfe8; color: #be185d; }
.btn-kudos:hover { background: #fce7f3; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn.disabled { opacity: .35; pointer-events: none; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .form > label { font-weight: 700; font-size: 13px; color: var(--text-2); }
.field label small { font-weight: 500; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 15px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=color] { height: 42px; padding: 4px; width: 90px; cursor: pointer; }
input[type=file] { padding: 8px; background: var(--surface-2); }
input:disabled { background: var(--surface-2); color: var(--muted); }
textarea { resize: vertical; min-height: 44px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.check input { width: auto; margin-top: 3px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }

.pri-pick, .status-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pri-pick label, .status-pick label { cursor: pointer; }
.pri-pick input, .status-pick input { position: absolute; opacity: 0; pointer-events: none; }
.pri-pick .pri { padding: 7px 12px; font-size: 12.5px; opacity: .5; border: 2px solid transparent; }
.pri-pick input:checked + .pri { opacity: 1; border-color: currentColor; }
.st-pill { display: inline-block; padding: 7px 12px; border-radius: 999px; font-weight: 700; font-size: 12.5px; border: 2px solid transparent; opacity: .55; }
.status-pick input:checked + .st-pill { opacity: 1; border-color: currentColor; }
.status-pick label.disabled { cursor: not-allowed; }
.status-pick label.disabled .st-pill { opacity: .25; text-decoration: line-through; }

/* ---------- Badges ---------- */
.badge, .pri, .due, .role { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--text-2); }
.st-todo { background: #f1f3f6; color: #4b5563; }
.st-in_progress { background: #e8f0ff; color: #1d4ed8; }
.st-in_review { background: #f3ecff; color: #6d28d9; }
.st-changes { background: #fff3e6; color: #c2410c; }
.st-on_hold { background: #fef9e7; color: #a16207; }
.st-done { background: #e7f7ee; color: #15803d; }
.st-bg-todo { background: #9ca3af; } .st-bg-in_progress { background: #3b82f6; } .st-bg-in_review { background: #8b5cf6; }
.st-bg-changes { background: #f97316; } .st-bg-on_hold { background: #eab308; } .st-bg-done { background: #22c55e; }
.pri-urgent { background: #fee2e2; color: #b91c1c; }
.pri-high { background: #ffedd5; color: #c2410c; }
.pri-medium { background: #e0ecff; color: #1d4ed8; }
.pri-low { background: #f1f3f6; color: #4b5563; }
.due { background: transparent; padding-left: 0; padding-right: 0; color: var(--muted); font-weight: 600; }
.due-over { color: var(--danger); font-weight: 800; }
.due-today { color: var(--warn); font-weight: 800; }
.due-soon { color: #b45309; }
.due-ok { color: var(--ok); }
.due-late { color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.role-superadmin { background: #111827; color: #fff; }
.role-admin { background: var(--brand-soft); color: var(--brand); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--text-2); max-width: 100%; }
.chip i { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.chip-none { color: var(--muted); font-weight: 600; }
.stars { color: #f59e0b; letter-spacing: 1px; font-size: 13px; }
.stars .off { color: #e5e7eb; }

.avatar { --h: 220; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: none; font-weight: 800; font-size: 12.5px; color: hsl(var(--h) 55% 32%); background: hsl(var(--h) 70% 90%); }
.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 18px; }
.avatar-empty { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--border); }
.person { display: inline-flex; align-items: center; gap: 9px; color: var(--text); min-width: 0; }
.person > span:last-child { display: flex; flex-direction: column; min-width: 0; font-weight: 600; }
.person small { color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.person:hover { text-decoration: none; color: var(--brand); }
.you { color: var(--muted); }

/* ---------- Flash ---------- */
.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; font-size: 13.5px; border: 1px solid; }
.flash-success { background: #ecfdf3; border-color: #bbf0cf; color: #166534; }
.flash-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-info { background: var(--brand-soft); border-color: var(--brand-line); color: var(--text); }
.notice { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #fff7ed; color: #9a3412; font-weight: 700; font-size: 13px; }

/* ---------- Dashboard ---------- */
.hello { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 18px; }
.hello h2 { font-size: 22px; font-weight: 800; }
.hello p { margin: 2px 0 0; }
.my-rank { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 13px; }
.my-rank:hover { text-decoration: none; background: #fef3c7; }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); position: relative; overflow: hidden; }
a.kpi:hover { text-decoration: none; border-color: var(--brand-line); }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.kpi-danger::before { background: var(--danger); } .kpi-warn::before { background: var(--warn); }
.kpi-ok::before { background: var(--ok); } .kpi-purple::before { background: var(--purple); }
.kpi-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.kpi strong { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.kpi strong small { font-size: 14px; color: var(--muted); font-weight: 700; }
.kpi-danger strong { color: var(--danger); }

.stack { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 2px; background: var(--surface-2); }
.stack .seg { display: block; min-width: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li + li { border-top: 1px solid var(--border); }
.mini-list a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; color: var(--text); }
.mini-list a:hover { text-decoration: none; background: var(--surface-2); }
.mini-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mini-main strong { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.mini-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }

.proj-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.proj-list a { display: flex; justify-content: space-between; gap: 10px; color: var(--text); margin-bottom: 6px; }
.proj-list a:hover { text-decoration: none; color: var(--brand); }
.proj-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.proj-name i { width: 9px; height: 9px; border-radius: 3px; }
.progress { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress span { display: block; height: 100%; border-radius: 999px; }

.podium { list-style: none; margin: 0; padding: 0; }
.podium li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; }
.podium li + li { border-top: 1px solid var(--border); }
.podium li.is-me { background: var(--brand-soft); border-radius: 10px; }
.podium .grow { flex: 1; display: flex; flex-direction: column; font-weight: 700; min-width: 0; }
.podium .grow small { color: var(--muted); font-weight: 500; }
.rank { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); font-weight: 800; font-size: 12px; color: var(--muted); flex: none; }
.rank.r1 { background: #fde68a; color: #92400e; } .rank.r2 { background: #e5e7eb; color: #374151; } .rank.r3 { background: #fed7aa; color: #9a3412; }

.feed, .kudos-list { list-style: none; margin: 0; padding: 0; }
.feed li, .kudos-list li { display: flex; gap: 10px; padding: 8px 0; font-size: 13px; }
.feed li + li, .kudos-list li + li { border-top: 1px solid var(--border); }
.feed small, .kudos-list small { display: block; color: var(--muted); margin-top: 2px; }
.kudo-ico { color: #db2777; margin-top: 2px; }
.kudo-line { font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--border); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 800; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table.compact th, .table.compact td { padding: 8px 10px; }
.card:not(.flush) .table th { background: transparent; }
.tasks-table tbody tr { cursor: pointer; }
.tasks-table tbody tr:hover { background: var(--surface-2); }
.t-title { font-weight: 700; color: var(--text); display: block; }
.t-title:hover { color: var(--brand); text-decoration: none; }
.t-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.is-restricted td { opacity: .55; }
.is-me td { background: var(--brand-soft); }
.actions-cell { text-align: right; width: 1%; white-space: nowrap; }

/* Dropdown menu */
.menu { position: relative; display: inline-block; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 250px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(0, 0, 0, .12); text-align: left; white-space: normal; }
.menu-pop a, .menu-pop button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--text); cursor: pointer; text-align: left; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); text-decoration: none; }
.menu-pop .del-form { border-top: 1px solid var(--border); margin-top: 4px; padding: 8px 4px 0; display: flex; flex-direction: column; gap: 6px; }
.menu-pop .del-form select { font-size: 13px; padding: 7px 30px 7px 10px; }

/* ---------- Tasks page ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.filters select { width: auto; padding: 8px 30px 8px 11px; font-size: 13.5px; font-weight: 600; }
.search { position: relative; flex: 1 1 220px; }
.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding: 8px 12px 8px 36px; font-size: 13.5px; }
.seg-toggle { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg-toggle a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 7px; color: var(--muted); font-weight: 700; font-size: 13px; }
.seg-toggle a:hover { text-decoration: none; color: var(--text); }
.seg-toggle a.on { background: var(--brand-soft); color: var(--brand); }
.seg-toggle .ico { width: 16px; height: 16px; }

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.board-hint { margin: -4px 0 10px; }
.col { background: #eceef2; border-radius: var(--radius); padding: 10px; min-height: 120px; transition: background .15s, box-shadow .15s; }
.col.over { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand-line); }
.col-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 13px; padding: 2px 4px 10px; }
.col-head .dot { width: 9px; height: 9px; border-radius: 50%; }
.col-count { margin-left: auto; background: var(--surface); border-radius: 999px; padding: 1px 8px; font-size: 12px; color: var(--muted); }
.col-body { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.tcard { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 11px; color: var(--text); box-shadow: var(--shadow); }
.tcard:hover { text-decoration: none; border-color: var(--brand-line); }
.tcard[draggable=true] { cursor: grab; }
.tcard.dragging { opacity: .4; }
.tcard strong { font-size: 13.5px; font-weight: 700; line-height: 1.35; }
.tcard-top, .tcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tcard-top .chip { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tcard-foot { justify-content: flex-start; }
.tcard-foot .stars { margin-left: auto; }

/* ---------- Task detail ---------- */
.task-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.task-head h2 { font-size: 22px; font-weight: 800; margin: 8px 0 10px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.desc { white-space: normal; color: var(--text-2); line-height: 1.65; padding: 14px; background: var(--surface-2); border-radius: 10px; }
.file-link { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); }
.file-link:hover { text-decoration: none; border-color: var(--brand-line); background: var(--brand-soft); }
.file-link > .ico:first-child { color: #0369a1; width: 22px; height: 22px; }
.file-link span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.file-link small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; margin: 0; font-size: 13.5px; }
.meta dt { color: var(--muted); font-weight: 600; }
.meta dd { margin: 0; font-weight: 600; text-align: right; display: flex; justify-content: flex-end; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 16px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 10px 0; }
.timeline li + li { border-top: 1px dashed var(--border); }
.timeline li > div { flex: 1; min-width: 0; }
.tl-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tl-head small { color: var(--muted); }
.tl-body { margin-top: 3px; font-size: 13.5px; overflow-wrap: anywhere; }
.bubble { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px 12px 12px 12px; padding: 9px 12px; display: block; margin-top: 4px; }
.tl-rating .tl-body, .tl-kudos .tl-body { color: #92400e; font-weight: 600; }
.rating-show { display: flex; align-items: center; justify-content: space-between; font-size: 20px; margin-bottom: 8px; }
.rating-show .stars { font-size: 22px; }
.star-input { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label { font-size: 32px; line-height: 1; color: #e5e7eb; cursor: pointer; transition: color .1s, transform .1s; }
.star-input label:hover, .star-input label:hover ~ label, .star-input input:checked ~ label { color: #f59e0b; }
.star-input label:active { transform: scale(.9); }

/* ---------- Projects ---------- */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.proj-card { margin: 0; border-top: 4px solid var(--pc); display: flex; flex-direction: column; gap: 10px; }
.proj-card.is-archived { opacity: .6; }
.proj-card h3 { color: var(--text); font-size: 16px; }
.proj-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.proj-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 12.5px; color: var(--muted); }
.proj-stats strong { color: var(--text); }
.proj-stats .text-danger strong { color: var(--danger); }
.proj-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: auto; }

/* ---------- Leaderboard ---------- */
.month-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 16px; font-size: 16px; }
.winners { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; align-items: end; }
.winner { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-align: center; box-shadow: var(--shadow); }
.winner.w1 { order: 2; padding-top: 26px; background: linear-gradient(180deg, #fffbeb, #fff); border-color: #fde68a; }
.winner.w2 { order: 1; } .winner.w3 { order: 3; }
.medal { font-size: 28px; }
.winner small { color: var(--muted); }
.winner .pts { font-weight: 800; font-size: 18px; color: var(--brand); }
.rules { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-2); }

/* ---------- Team / data / settings ---------- */
.secret { display: flex; align-items: center; gap: 10px; margin: 10px 0 14px; }
.secret code { font-size: 20px; padding: 8px 14px; background: #fff; letter-spacing: .05em; }
.action-list { display: flex; flex-direction: column; gap: 8px; }
.action-list a { display: flex; flex-direction: column; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); }
.action-list a:hover { text-decoration: none; border-color: var(--brand-line); background: var(--brand-soft); }
.action-list small { color: var(--muted); }
.export-range { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); gap: 8px; }
.msgs { max-height: 220px; overflow: auto; padding-left: 18px; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.logo-preview { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.logo-preview img { width: 64px; height: 64px; object-fit: contain; border-radius: 12px; border: 1px solid var(--border); background: #fff; }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.profile-head p { margin: 2px 0 0; }

/* ---------- Auth ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, var(--brand-soft), var(--bg)); }
.auth-wrap { width: 100%; max-width: 440px; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-brand .brand { font-size: 19px; }
.auth-card { padding: 28px; }
.auth-card h1 { font-size: 22px; font-weight: 800; margin-bottom: 14px; }
.auth-card .center { margin: 16px 0 0; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .task-layout { grid-template-columns: minmax(0, 1fr) 290px; }
}

@media (max-width: 900px) {
  body { font-size: 15px; }
  .app { grid-template-columns: 1fr; }
  .only-mobile { display: inline-grid !important; }
  a.only-mobile.btn, .btn.only-mobile { display: flex !important; margin-top: 12px; }
  .hide-mobile { display: none !important; }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: 280px; height: 100%; transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .15); padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .drawer-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 55; background: rgba(15, 23, 42, .4); }
  .drawer-open .scrim { display: block; }
  .topbar { padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); gap: 6px; background: var(--surface); border-bottom-color: var(--border); }
  .topbar h1 { font-size: 17px; }
  .content { padding: 14px 12px calc(96px + env(safe-area-inset-bottom)); }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 700; color: var(--muted); }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav a.active { color: var(--brand); }
  .bottom-nav .ico { width: 22px; height: 22px; }
  .bottom-nav a[data-wa] .ico { color: #16a34a; }
  .bottom-nav .fab { justify-self: center; width: 52px; height: 52px; margin-top: -22px; border-radius: 16px; background: var(--brand); color: #fff; justify-content: center; box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 45%, transparent); }
  .bottom-nav .fab .ico { width: 26px; height: 26px; }

  .grid-2, .grid-side, .grid-side-r, .task-layout { grid-template-columns: 1fr; }
  .grid-2 > .card, .grid-2 > div > .card:last-child { margin-bottom: 0; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px 14px; }
  .kpi strong { font-size: 22px; }
  .hello { flex-direction: column; align-items: flex-start; }
  .hello h2 { font-size: 19px; }
  .card { padding: 15px; border-radius: 13px; }
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .row-2 .row-2 { grid-template-columns: 1fr 1fr; }
  input, select, textarea { font-size: 16px; } /* stops iOS zoom */
  .filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px 12px; padding: 0 12px 4px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filters .search { flex: 0 0 180px; }
  .filters select { flex: none; font-size: 14px; }
  .seg-toggle span { display: none; }

  /* Task table → cards */
  .tasks-table thead { display: none; }
  .tasks-table, .tasks-table tbody, .tasks-table tr, .tasks-table td { display: block; }
  .tasks-table tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 13px 14px; border-bottom: 1px solid var(--border); }
  .tasks-table td { padding: 0; border: 0; }
  .tasks-table .t-main { grid-column: 1 / -1; }
  .tasks-table .t-who { grid-column: 1; grid-row: 2; font-size: 13px; }
  .tasks-table .t-who .avatar { width: 24px; height: 24px; font-size: 10px; }
  .tasks-table .t-due { grid-column: 2; grid-row: 2; text-align: right; align-self: center; }
  .tasks-table .t-pri, .tasks-table .t-st { grid-row: 3; }
  .tasks-table .t-pri { grid-column: 1; }
  .tasks-table .t-st { grid-column: 2; text-align: right; }

  .team-table thead { display: none; }
  .team-table tr { display: grid; grid-template-columns: 1fr auto; padding: 12px; border-bottom: 1px solid var(--border); gap: 6px; }
  .team-table td { display: block; padding: 0; border: 0; }
  .team-table td:nth-child(1) { grid-column: 1 / -1; }
  .team-table td:nth-child(3), .team-table td:nth-child(4) { display: none; }
  .menu-pop { position: fixed; left: 12px; right: 12px; top: auto; bottom: calc(80px + env(safe-area-inset-bottom)); min-width: 0; }

  .lb-table th:nth-child(5), .lb-table td:nth-child(5), .lb-table th:nth-child(6), .lb-table td:nth-child(6) { display: none; }
  .lb-table th, .lb-table td { padding: 10px 8px; }
  .winners { gap: 8px; }
  .winner { padding: 14px 6px; }
  .winner strong { font-size: 13px; }
  .winner small { display: none; }
  .winner .avatar-lg { width: 44px; height: 44px; font-size: 15px; }

  .board { grid-auto-columns: 82%; scroll-snap-type: x mandatory; margin: 0 -12px; padding: 0 12px 12px; }
  .col { scroll-snap-align: start; }
  .task-head h2 { font-size: 19px; }
  .comment-form { flex-direction: column; align-items: stretch; }
  .inline-form { flex-direction: column; }
  .meta dd { text-align: right; }
  .proj-grid { grid-template-columns: 1fr; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #171a20; --surface-2: #1e222a; --border: #2a2f39;
    --text: #eef0f3; --text-2: #c9ced8; --muted: #8b93a3;
    --brand-soft: color-mix(in srgb, var(--brand) 18%, #171a20);
    --brand-line: color-mix(in srgb, var(--brand) 45%, #171a20);
    --shadow: none;
  }
  .col { background: #12151a; }
  .st-todo, .pri-low { background: #262b34; color: #c9ced8; }
  .st-in_progress, .pri-medium { background: #172554; color: #93c5fd; }
  .st-in_review { background: #2e1065; color: #c4b5fd; }
  .st-changes, .pri-high { background: #431407; color: #fdba74; }
  .st-on_hold { background: #422006; color: #fde047; }
  .st-done { background: #052e16; color: #86efac; }
  .pri-urgent, .badge-danger { background: #450a0a; color: #fca5a5; }
  .avatar { color: hsl(var(--h) 70% 85%); background: hsl(var(--h) 35% 25%); }
  .stars .off { color: #374151; }
  .star-input label { color: #374151; }
  .flash-success { background: #052e16; border-color: #14532d; color: #86efac; }
  .flash-error { background: #450a0a; border-color: #7f1d1d; color: #fca5a5; }
  .my-rank, .winner.w1 { background: #2a2006; border-color: #713f12; color: #fde68a; }
  .notice { background: #2a1606; color: #fdba74; }
  .btn-kudos { background: #3b0a24; border-color: #831843; color: #f9a8d4; }
  .role-superadmin { background: #eef0f3; color: #111827; }
  .secret code { background: var(--surface); }
  .rank.r1 { background: #713f12; color: #fde68a; } .rank.r2 { background: #374151; color: #e5e7eb; } .rank.r3 { background: #7c2d12; color: #fed7aa; }
  .topbar { background: color-mix(in srgb, var(--bg) 88%, transparent); }
  select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b93a3' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
}
@media (prefers-color-scheme: dark) and (max-width: 900px) {
  .topbar { background: var(--surface); }
}

/* ---------- v2: categories, cancelled, links ---------- */
.st-cancelled { background: #f3f4f6; color: #6b7280; text-decoration: line-through; }
.st-bg-cancelled { background: #cbd5e1; }
.cat { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tcard .cat { align-self: flex-start; }

.links-bar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.links-bar .search { max-width: 420px; flex: none; width: 100%; }
.topic-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.topic-chips a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-weight: 700; font-size: 12.5px; }
.topic-chips a:hover { text-decoration: none; border-color: var(--brand-line); color: var(--brand); }
.topic-chips span { color: var(--muted); font-weight: 600; }
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; align-items: start; }
.link-grid .card { margin: 0; min-width: 0; }
.link-group, .link-row { min-width: 0; }
.link-group h3 { margin-bottom: 8px; scroll-margin-top: 80px; }
.pinned-group { border-color: #fde68a; }
.link-list { list-style: none; margin: 0; padding: 0; }
.link-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; }
.link-row + .link-row { border-top: 1px solid var(--border); }
.link-main { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--text); }
.link-main:hover { text-decoration: none; }
.link-main:hover strong { color: var(--brand); }
.link-main strong { font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-actions { display: flex; gap: 2px; flex: none; }
.link-actions form { display: contents; }
.link-actions .icon-btn { width: 32px; height: 32px; color: var(--muted); }
.link-actions .is-pinned { color: #f59e0b; }
.kind { flex: none; width: 58px; text-align: center; padding: 4px 0; border-radius: 7px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.k-sheet { background: #e7f7ee; color: #15803d; } .k-doc { background: #e0ecff; color: #1d4ed8; }
.k-slides { background: #fef3c7; color: #b45309; } .k-form { background: #f3ecff; color: #6d28d9; }
.k-drive { background: #e0f2fe; color: #0369a1; } .k-onedrive { background: #dbeafe; color: #1e40af; }
.k-looker { background: #e0e7ff; color: #4338ca; } .k-web { background: var(--surface-2); color: var(--text-2); }
@media (max-width: 900px) {
  .link-grid { grid-template-columns: minmax(0, 1fr); }
  .topic-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px; padding: 0 12px 4px; scrollbar-width: none; }
  .topic-chips a { flex: none; }
  .kind { width: 50px; font-size: 9.5px; }
}
@media (prefers-color-scheme: dark) {
  .st-cancelled { background: #262b34; color: #8b93a3; }
  .k-sheet { background: #052e16; color: #86efac; } .k-doc, .k-onedrive { background: #172554; color: #93c5fd; }
  .k-slides { background: #422006; color: #fde047; } .k-form, .k-looker { background: #2e1065; color: #c4b5fd; }
  .k-drive { background: #082f49; color: #7dd3fc; }
}
@media (min-width: 901px) {
  .tasks-table td:not(.t-main), .tasks-table th:not(:first-child) { white-space: nowrap; width: 1%; }
  .tasks-table .t-title { overflow-wrap: anywhere; }
}

/* ---------- Board: fit the screen, scroll each column (v1.0.1) ---------- */
.content:has(.board) { max-width: none; }
.board {
  height: calc(100vh - 190px); height: calc(100dvh - 190px); min-height: 420px;
  align-items: stretch; grid-auto-columns: minmax(250px, 1fr);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: #c3c8d2 transparent;
}
.board::-webkit-scrollbar { height: 10px; }
.board::-webkit-scrollbar-thumb { background: #c3c8d2; border-radius: 999px; }
.board .col { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.board .col-body { flex: 1; min-height: 60px; overflow-y: auto; overscroll-behavior: contain; padding: 2px 2px 8px; scrollbar-width: thin; }
.board .col-body::-webkit-scrollbar { width: 6px; }
.board .col-body::-webkit-scrollbar-thumb { background: #cfd3db; border-radius: 999px; }
@media (max-width: 900px) {
  .board { height: calc(100vh - 230px); height: calc(100dvh - 230px); grid-auto-columns: 82vw; scroll-snap-type: x mandatory; }
  .board .col { scroll-snap-align: start; }
}


/* ---------- v1.1: shared tasks, bulk assign, mobile overflow fix ---------- */
.main { overflow-x: clip; }
.people-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.people-pick label { cursor: pointer; }
.people-pick label.is-main { display: none; }
.people-pick input { position: absolute; opacity: 0; pointer-events: none; }
.people-pick span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 13px; color: var(--text-2); }
.people-pick input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.people-pick input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-soft); }
.more-people { font-size: 11px; font-weight: 800; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; }
.meta dd .unshare { display: inline-flex; margin-left: 4px; }
.meta dd .unshare button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 4px; }
.meta dd .unshare button:hover { color: var(--danger); }
.share-form { display: flex; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.share-form select { padding: 7px 30px 7px 10px; font-size: 13.5px; }
.t-main-row { display: flex; gap: 10px; align-items: flex-start; }
.t-main-row > div { flex: 1; min-width: 0; }
.t-sel { display: inline-flex; padding: 2px; cursor: pointer; }
.t-sel input, .sel-all input { width: 17px; height: 17px; margin: 0; padding: 0; accent-color: var(--brand); cursor: pointer; flex: none; }
.sel-all { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; color: var(--text-2); margin: 0 0 10px 15px; cursor: pointer; }
.bulk-bar { position: sticky; bottom: 14px; z-index: 25; display: none; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; margin: 0 0 16px; background: var(--surface); border: 1px solid var(--brand-line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .14); }
.bulk-bar.on { display: flex; }
.bulk-bar select { width: auto; padding: 8px 30px 8px 11px; font-size: 13.5px; }
.bulk-bar .sel-count { font-weight: 800; margin-right: auto; }
.tasks-table tr.is-selected td, .tasks-table tr.is-selected { background: var(--brand-soft); }
@media (max-width: 900px) {
.grid-2, .grid-side, .grid-side-r, .task-layout { grid-template-columns: minmax(0, 1fr); }
.grid-2 > *, .kpis > *, .task-layout > * { min-width: 0; }
.table.compact th, .table.compact td { padding: 8px 6px; }
.table.compact .person small { display: none; }
.sel-all { margin-left: 4px; }
.bulk-bar { bottom: calc(84px + env(safe-area-inset-bottom)); }
.bulk-bar .sel-count { width: 100%; }
.bulk-bar select { flex: 1 1 140px; font-size: 16px; }
.share-form select { font-size: 16px; }
}
/* v1.1.1: never let the page grow wider than the phone screen (older Safari / iPhone) */
@media (max-width: 900px) {
html, body { max-width: 100%; overflow-x: hidden; }
.app, .main, .content { max-width: 100vw; }
.content > *, .card, .kpis, .grid-2 { max-width: 100%; min-width: 0; }
.grid-2 { display: block; }
.grid-2 > .card { margin-bottom: 16px; }
.mini-list a { min-width: 0; }
.mini-main { flex: 1; }
.mini-main strong { white-space: normal; overflow-wrap: anywhere; }
.table-wrap { max-width: 100%; -webkit-overflow-scrolling: touch; }
}
/* ---------- v1.2: quick filters, bulk update, calendar & notes, inventory ---------- */
.ico-xs { width: 12px; height: 12px; }
.text-ok { color: var(--ok); }
.d-block { display: block; }

/* Quick filter chips (task list) */
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.quick a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.quick a:hover { text-decoration: none; border-color: var(--brand-line); }
.quick a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.quick a i { width: 8px; height: 8px; border-radius: 50%; }
.quick .q-urgent i { background: #dc2626; } .quick .q-high i { background: #ea580c; } .quick .q-over i { background: var(--danger); } .quick .q-today i { background: var(--warn); }
.quick .sep { width: 1px; background: var(--border); margin: 2px 2px; }

/* Bulk bar: action-dependent inputs */
.bulk-bar .bulk-opt { display: none; align-items: center; gap: 6px; }
.bulk-bar .bulk-opt.on { display: inline-flex; }
.bulk-bar input[type=date], .bulk-bar input[type=number] { width: auto; padding: 7px 10px; font-size: 13.5px; }
.bulk-bar input[type=number] { width: 80px; }

/* Calendar */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.cal-card { padding: 14px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav h2 { font-size: 18px; font-weight: 800; min-width: 150px; text-align: center; }
.cal-nav .icon-btn { font-size: 22px; line-height: 1; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; color: var(--text); }
.cal-nav .icon-btn:hover { background: var(--surface-2); text-decoration: none; }
.cal-who select { width: auto; padding: 7px 30px 7px 11px; font-size: 13.5px; font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.cal-dow { padding: 6px 8px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal-day { position: relative; min-height: 104px; padding: 5px 6px 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.weekend { background: var(--surface-2); }
.cal-day.out { opacity: .45; }
.cal-day:hover { background: var(--brand-soft); }
.cal-day.sel { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-day-link { position: absolute; inset: 0; z-index: 1; }
.cal-day-top { display: flex; align-items: center; gap: 4px; }
.cal-num { font-weight: 800; font-size: 12.5px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--brand); color: #fff; }
.cal-note-dot { color: var(--purple); display: inline-flex; }
.cal-add { position: relative; z-index: 2; margin-left: auto; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--brand); font-weight: 800; font-size: 15px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .12s; padding: 0; }
.cal-day:hover .cal-add, .cal-day.sel .cal-add, .cal-add:focus-visible { opacity: 1; }
.cal-items { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cal-item { position: relative; z-index: 2; display: block; padding: 2px 6px; border-radius: 5px; font-size: 11.5px; font-weight: 600; color: var(--text); background: var(--surface-2); border-left: 3px solid var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item:hover { text-decoration: none; filter: brightness(.96); }
.cal-item.pri-b-urgent { border-left-color: #dc2626; } .cal-item.pri-b-high { border-left-color: #ea580c; }
.cal-item.pri-b-medium { border-left-color: #3b82f6; } .cal-item.pri-b-low { border-left-color: #9ca3af; }
.cal-item.is-over { background: #fee2e2; color: #991b1b; }
.cal-item.is-done { text-decoration: line-through; color: var(--muted); border-left-color: #22c55e; }
.cal-more { font-size: 11px; font-weight: 700; color: var(--muted); padding-left: 4px; }
.cal-dots { display: none; gap: 3px; flex-wrap: wrap; }
.cal-dots i, .cal-legend i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: #3b82f6; }
.pri-d-urgent { background: #dc2626 !important; } .pri-d-high { background: #ea580c !important; } .pri-d-medium { background: #3b82f6 !important; } .pri-d-low { background: #9ca3af !important; }
.cal-dots i.is-done, .cal-legend i.is-done { background: #22c55e !important; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; align-items: center; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }

/* Notes */
.cal-side { position: sticky; top: 14px; }
.note-form textarea { min-height: 150px; font-size: 14px; line-height: 1.55; }
.note-form { gap: 8px; }
.note-opts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.note-opts input[type=date] { width: auto; padding: 7px 10px; font-size: 13.5px; }
.note-hint { margin-left: auto; align-self: center; }
.notes-list { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.note { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); }
.note-shared { border-style: dashed; }
.note-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.note-head strong { font-size: 13.5px; }
.note-tools { margin-left: auto; display: inline-flex; gap: 2px; }
.note-tools a, .note-tools button { display: inline-flex; padding: 4px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 6px; }
.note-tools a:hover, .note-tools button:hover { background: var(--surface); color: var(--text); }
.note-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.note-lines li { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; font-size: 13.5px; border-top: 1px solid var(--border); }
.note-lines li:first-child { border-top: 0; }
.note-lines li > span { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-lines li.is-task > span { color: var(--muted); }
.to-task { flex: none; border: 1px solid var(--brand-line); background: var(--surface); color: var(--brand); border-radius: 999px; font: inherit; font-size: 11.5px; font-weight: 800; padding: 2px 9px; cursor: pointer; opacity: .55; }
.note-lines li:hover .to-task, .to-task:focus-visible { opacity: 1; }
.to-task:hover { background: var(--brand); color: #fff; }
.recent-notes { list-style: none; margin: 0; padding: 0; }
.recent-notes a { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); color: var(--text); font-size: 13px; }
.recent-notes li:first-child a { border-top: 0; }
.recent-notes small { color: var(--muted); white-space: nowrap; }

/* Quick task dialog */
.qt-dialog { border: 0; padding: 0; border-radius: var(--radius); width: min(520px, calc(100vw - 24px)); background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
.qt-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.qt-dialog form { padding: 18px; }
.qt-dialog .card-head { margin-bottom: 0; }

/* Inventory */
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.inv-ok { background: #e7f7ee; color: #15803d; }
.inv-low { background: #fff3e6; color: #c2410c; }
.inv-out { background: #fee2e2; color: #b91c1c; }
.inv-out-row td { background: color-mix(in srgb, #fee2e2 35%, transparent); }
.inv-qty { font-size: 16px; }
.inv-big { display: flex; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.inv-big strong { font-size: 32px; font-weight: 800; }
.inv-move { gap: 8px; padding: 6px 4px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.inv-move-row { display: grid; grid-template-columns: 1fr 90px; gap: 6px; }
.inv-move select, .inv-move input { padding: 8px 10px; font-size: 13.5px; }
.inv-move select { padding-right: 28px; }
.inv-pop { min-width: 280px; text-align: left; }
.inv-pop .inv-move button { justify-content: center; background: var(--brand); color: #fff; }
.inv-table td { vertical-align: top; }
.card.flush:has(.inv-table) { overflow: visible; }
.inv-table thead th:first-child { border-top-left-radius: var(--radius); }
.inv-table thead th:last-child { border-top-right-radius: var(--radius); }

@media (max-width: 1100px) {
  .cal-layout { grid-template-columns: minmax(0, 1fr); }
  .cal-side { position: static; }
}
@media (max-width: 900px) {
  .quick { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px 8px; padding: 0 12px 4px; scrollbar-width: none; }
  .quick::-webkit-scrollbar { display: none; }
  .bulk-bar .bulk-opt.on { flex: 1 1 100%; }
  .bulk-bar input[type=date] { flex: 1; font-size: 16px; }
  .cal-card { padding: 8px; }
  .cal-day { min-height: 58px; padding: 3px; }
  .cal-items, .cal-add { display: none; }
  .cal-dots { display: flex; padding-left: 3px; }
  .cal-num { font-size: 12px; width: 22px; height: 22px; }
  .cal-dow { padding: 5px 2px; text-align: center; font-size: 10px; }
  .cal-nav h2 { min-width: 0; font-size: 16px; }
  .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .note-hint { display: none; }
  .note-opts input[type=date] { font-size: 16px; }
  .inv-pop { min-width: 0; }
  .to-task { opacity: 1; }
}
@media (prefers-color-scheme: dark) {
  .inv-ok { background: #052e16; color: #86efac; }
  .inv-low { background: #431407; color: #fdba74; }
  .inv-out { background: #450a0a; color: #fca5a5; }
  .inv-out-row td { background: rgba(127, 29, 29, .18); }
  .cal-item.is-over { background: #450a0a; color: #fca5a5; }
}

/* v1.2.1: created date */
.date-range { display: inline-flex; align-items: center; gap: 6px; }
.date-range label { font-weight: 700; font-size: 12.5px; color: var(--muted); }
.date-range input { width: auto; padding: 7px 10px; font-size: 13.5px; }
.t-created { white-space: nowrap; }
.t-cr { margin-left: 6px; }
@media (max-width: 900px) { .date-range { flex: none; } .date-range input { font-size: 16px; } }

/* v1.3.1: dropdown menus inside flush cards (Team > Manage) must not be clipped */
.card.flush:has(.menu) { overflow: visible; }
.card.flush:has(.menu) .table thead th:first-child { border-top-left-radius: inherit; }
.card.flush:has(.menu) .table thead th:last-child { border-top-right-radius: inherit; }
.card.flush .table tbody tr:nth-last-child(-n+3):not(:nth-child(-n+3)) .menu-pop { top: auto; bottom: calc(100% + 4px); }