/* SASG Desk — mobile-first, Apple HIG with a Swiss grid. One accent: the navy of the SASG mark. */

:root {
  color-scheme: light dark;
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --fill: rgba(118, 118, 128, 0.12);
  --fill-2: rgba(118, 118, 128, 0.2);
  --text: #1d1d1f;
  --text-2: #5f5f64;
  --text-3: #8a8a8e;
  --sep: rgba(60, 60, 67, 0.16);
  --sep-strong: rgba(60, 60, 67, 0.29);
  --accent: #1f2a44;
  --accent-ink: #ffffff;
  --accent-soft: rgba(31, 42, 68, 0.08);
  --accent-text: #1f2a44;
  --green: #1d7a37;
  --green-soft: rgba(36, 138, 61, 0.12);
  --orange: #a84b00;
  --orange-soft: rgba(201, 105, 0, 0.12);
  --red: #c4281c;
  --red-soft: rgba(215, 0, 21, 0.09);
  --bar: rgba(242, 242, 247, 0.82);
  --shadow-lift: 0 12px 32px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08);
  --r: 12px;
  --r-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --tabbar-h: 56px;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-2: rgba(118, 118, 128, 0.36);
    --text: #f5f5f7;
    --text-2: #a8a8ad;
    --text-3: #8d8d93;
    --sep: rgba(84, 84, 88, 0.6);
    --sep-strong: rgba(120, 120, 128, 0.7);
    --accent: #c9d3ea;
    --accent-ink: #0d1424;
    --accent-soft: rgba(169, 184, 221, 0.14);
    --accent-text: #b4c2e4;
    --green: #32d74b;
    --green-soft: rgba(50, 215, 75, 0.15);
    --orange: #ffa53a;
    --orange-soft: rgba(255, 159, 10, 0.16);
    --red: #ff6961;
    --red-soft: rgba(255, 69, 58, 0.16);
    --bar: rgba(22, 22, 24, 0.82);
    --shadow-lift: 0 12px 32px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.4);
  }
  .logo, .login-logo, .slip-logo { filter: invert(1) hue-rotate(180deg) brightness(1.05); }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.45 var(--font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.no-scroll { overflow: hidden; }
a { color: var(--accent-text); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
h1, h2, h3, h4, p { margin: 0; }
small { font-size: 13px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.icon { width: 22px; height: 22px; flex: none; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App shell (phone first) ---------- */
.app { min-height: 100dvh; }
.sidebar { display: none; }
.main {
  padding: calc(var(--safe-t) + 8px) calc(var(--gutter) + var(--safe-r)) calc(var(--tabbar-h) + var(--safe-b) + 32px) calc(var(--gutter) + var(--safe-l));
  max-width: 1280px;
  margin: 0 auto;
}
.navbar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  height: calc(44px + var(--safe-t)); padding-top: var(--safe-t);
  display: flex; align-items: center; justify-content: center;
  background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--sep);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.navbar.show { opacity: 1; }
.navbar-title { font-weight: 600; font-size: 17px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: 36px 0 16px;
}
.eyebrow { font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; min-height: 0; }
.eyebrow:empty { display: none; }
.large-title { font-size: 32px; line-height: 1.1; font-weight: 700; letter-spacing: -0.025em; }
.page-actions { display: flex; gap: 8px; flex: none; }
#view:focus { outline: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
  background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--sep);
}
.tabbar a {
  height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-3); font-size: 10.5px; font-weight: 500; letter-spacing: 0;
}
.tabbar a .icon { width: 25px; height: 25px; }
.tabbar a.active { color: var(--accent-text); }

/* ---------- Desktop shell ---------- */
@media (min-width: 900px) {
  :root { --gutter: 40px; }
  .tabbar, .navbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column;
    position: fixed; inset: 0 auto 0 0; width: 248px; z-index: 20;
    padding: 24px 12px 16px; background: var(--surface); border-right: 0.5px solid var(--sep);
  }
  .brand { display: block; padding: 4px 12px 24px; }
  .logo { width: 116px; height: auto; display: block; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .side-nav a {
    display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: var(--r-sm);
    color: var(--text); font-size: 15px; font-weight: 500;
  }
  .side-nav a .icon { color: var(--text-2); width: 20px; height: 20px; }
  .side-nav a:hover { background: var(--fill); }
  .side-nav a.active { background: var(--accent-soft); color: var(--accent-text); }
  .side-nav a.active .icon { color: var(--accent-text); }
  .side-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 4px 0 8px; border-top: 0.5px solid var(--sep); }
  .side-foot .me { display: flex; gap: 10px; align-items: center; min-width: 0; }
  .side-foot .me div { display: flex; flex-direction: column; min-width: 0; }
  .side-foot strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-foot small { color: var(--text-2); font-size: 12px; text-transform: capitalize; }
  .app > .main { margin-left: 248px; padding: 0 var(--gutter) 64px; }
  .page-head { padding: 40px 0 24px; }
  .large-title { font-size: 30px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 10px;
  border: 0; background: var(--fill); color: var(--text);
  font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, opacity .15s, transform .1s;
}
.btn:active { transform: scale(0.98); }
.btn:hover { background: var(--fill-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { opacity: 0.92; }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.plain { background: transparent; color: var(--accent-text); padding: 0 8px; }
.btn.plain:hover { background: var(--fill); }
.btn.block { width: 100%; }
.btn.lg { min-height: 52px; font-size: 17px; border-radius: 14px; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn .icon { width: 18px; height: 18px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.loading { color: transparent !important; position: relative; }
.btn.loading::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--text-2) transparent var(--text-2) var(--text-2); animation: spin .7s linear infinite;
}
.btn.primary.loading::after { border-color: var(--accent-ink) transparent var(--accent-ink) var(--accent-ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%;
  border: 0; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--fill); }
.icon-btn.filled { background: var(--accent); color: var(--accent-ink); }
.icon-btn.filled:hover { opacity: .92; background: var(--accent); }
.page-actions .btn { min-height: 40px; }
@media (max-width: 899px) {
  .page-actions .btn .label { display: none; }
  .page-actions .btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
  .page-actions .btn.primary .icon { width: 22px; height: 22px; }
}

/* ---------- Cards & lists ---------- */
.card { background: var(--surface); border-radius: var(--r); padding: 16px; }
.section { margin-top: 28px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 4px 8px; }
.section-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.section-head .btn.plain { min-height: 32px; font-size: 15px; font-weight: 500; }
.section-label { font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; padding: 0 16px 6px; font-weight: 500; }
.section-foot { font-size: 13px; color: var(--text-2); padding: 6px 16px 0; }

.list { background: var(--surface); border-radius: var(--r); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 52px; padding: 10px 16px; background: none; border: 0; text-align: left; color: var(--text);
  position: relative; cursor: default;
}
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; border-top: 0.5px solid var(--sep); }
.row.has-avatar + .row.has-avatar::before { left: 64px; }
a.row, button.row { cursor: pointer; }
a.row:active, button.row:active { background: var(--fill); }
@media (hover: hover) { a.row:hover, button.row:hover { background: var(--surface-2); } }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-main > :first-child { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.row-main small { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.row-end { color: var(--text-2); font-size: 15px; display: flex; align-items: center; gap: 6px; flex: none; text-align: right; }
.row .chev { color: var(--text-3); width: 16px; height: 16px; }
.row.action { color: var(--accent-text); font-weight: 500; }
.row.action .icon { width: 20px; height: 20px; }
.row.action.danger { color: var(--red); }
.row.toggle-row { cursor: pointer; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  background: var(--fill); color: var(--text-2); font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: 0; background: var(--fill); color: var(--text-2); white-space: nowrap;
}
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; display: inline-block; }
.dot.todo { background: var(--text-3); }
.dot.in_progress { background: var(--accent-text); }
.dot.done { background: var(--green); }

.empty { text-align: center; padding: 48px 24px; }
.empty-title { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.empty .btn { margin-top: 16px; }
.loading-view { height: 40vh; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--surface); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; color: var(--text); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.stat.alert .stat-value { color: var(--red); }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border-radius: 10px; border: 0; background: var(--fill); color: var(--text);
  font-size: 16px; /* 16px stops iOS zoom on focus */
  outline: none; -webkit-appearance: none; appearance: none;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 0; }
textarea { resize: vertical; min-height: 88px; line-height: 1.4; }
select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238a8a8e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input[type=date], input[type=time], input[type=month] { min-width: 0; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
.form-error { color: var(--red); font-size: 14px; min-height: 0; }
.form-error:empty { display: none; }
.fieldset { display: flex; flex-direction: column; gap: 8px; }
.fieldset > .list .row { min-height: 48px; }

.switch {
  -webkit-appearance: none; appearance: none; flex: none; cursor: pointer;
  width: 51px; height: 31px; border-radius: 16px; background: var(--fill-2); position: relative; transition: background .2s; margin: 0;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s;
}
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }

.segmented {
  display: flex; padding: 2px; border-radius: 9px; background: var(--fill); gap: 2px; width: 100%;
}
.segmented label { flex: 1; position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 8px; border-radius: 7px;
  font-size: 14px; font-weight: 500; cursor: pointer; text-align: center; white-space: nowrap; color: var(--text);
}
.segmented input:checked + span { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 0.5px rgba(0,0,0,.04); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent-text); }
@media (prefers-color-scheme: dark) { .segmented input:checked + span { background: #636366; } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 48px; height: 36px; padding: 0 12px;
  border-radius: 18px; background: var(--fill); font-size: 14px; font-weight: 500; cursor: pointer;
}
.chip input:checked + span { background: var(--accent); color: var(--accent-ink); }
.chip input:focus-visible + span { outline: 2px solid var(--accent-text); outline-offset: 2px; }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; min-width: 160px; }
.toolbar select { width: auto; min-width: 0; }
.search { position: relative; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.search input { padding-left: 36px !important; }

.stepper { display: flex; align-items: center; gap: 4px; }
.stepper .label { min-width: 140px; text-align: center; font-weight: 600; font-size: 15px; }

/* ---------- Sheets ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 100; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.32); opacity: 0; transition: opacity .25s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: calc(100dvh - var(--safe-t) - 12px);
  display: flex; flex-direction: column;
  background: var(--bg); border-radius: 14px 14px 0 0;
  transform: translateY(100%); transition: transform .32s cubic-bezier(.32,.72,0,1);
  padding-bottom: var(--safe-b);
}
.sheet-wrap.in .sheet-backdrop { opacity: 1; }
.sheet-wrap.in .sheet { transform: none; }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); margin: 6px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px 4px 20px; flex: none; }
.sheet-head h2 { font-size: 17px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { padding: 8px 16px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; flex: 1; }
.sheet-foot {
  display: flex; gap: 10px; justify-content: flex-end; padding: 12px 16px; flex: none;
  border-top: 0.5px solid var(--sep); background: var(--bg);
}
.sheet-foot .btn { flex: 1; }
.sheet-foot .spacer { flex: 1; }
@media (min-width: 700px) {
  .sheet-wrap { display: grid; place-items: center; padding: 32px; }
  .sheet {
    position: relative; width: 100%; max-width: 560px; max-height: min(86vh, 900px);
    border-radius: 14px; transform: translateY(16px) scale(.98); opacity: 0;
    transition: transform .22s ease, opacity .22s ease; padding-bottom: 0;
    box-shadow: var(--shadow-lift);
  }
  .sheet.wide { max-width: 760px; }
  .sheet.small { max-width: 420px; }
  .sheet-wrap.in .sheet { opacity: 1; }
  .grabber { display: none; }
  .sheet-head { padding: 12px 8px 4px 24px; }
  .sheet-body { padding: 8px 24px 24px; }
  .sheet-foot { padding: 14px 24px; }
  .sheet-foot .btn { flex: 0 0 auto; min-width: 96px; }
}

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 420px; }
.toast {
  background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-size: 15px; font-weight: 500;
  box-shadow: var(--shadow-lift); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; text-align: center;
}
.toast.error { background: var(--red); color: #fff; }
.toast.in { opacity: 1; transform: none; }
@media (min-width: 900px) { #toasts { bottom: 24px; left: calc(50% + 124px); } }

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: calc(var(--safe-t) + 24px) 20px calc(var(--safe-b) + 24px); }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
.login-logo { width: 148px; height: auto; margin-bottom: 24px; }
.login-card h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.login-card > p.muted { margin-top: -10px; margin-bottom: 8px; }
.login-card input { background: var(--surface) !important; }
.fine { font-size: 13px; color: var(--text-2); text-align: center; }

/* ---------- Home ---------- */
.punch { display: grid; gap: 16px; }
.punch-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.punch-clock { font-size: 40px; font-weight: 300; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.punch-clock small { font-size: 17px; font-weight: 500; margin-left: 4px; color: var(--text-2); letter-spacing: 0; }
.punch-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 0.5px solid var(--sep); padding-top: 14px; }
.punch-meta div { display: flex; flex-direction: column; gap: 2px; }
.punch-meta span { font-size: 12px; color: var(--text-2); font-weight: 500; }
.punch-meta strong { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.punch-note { font-size: 13px; color: var(--text-2); display: flex; gap: 6px; align-items: flex-start; }
.punch-note .icon { width: 16px; height: 16px; margin-top: 1px; }
.punch.compact { gap: 14px; }
.punch-status { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.punch-status strong { font-size: 17px; font-weight: 600; }
.punch-status span { font-size: 15px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.home { display: grid; gap: 28px; max-width: 720px; }

/* ---------- Kanban ---------- */
.board-tabs { position: sticky; top: calc(var(--safe-t) + 44px); z-index: 10; margin: 0 calc(-1 * var(--gutter)) 12px; padding: 8px var(--gutter); background: var(--bg); }
.board-tabs .segmented span { gap: 6px; }
.board-tabs .count { font-size: 12px; color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.board-tabs .seg-target span { transition: background .15s, transform .15s; }
.board-tabs .seg-target.drop-hover span { background: var(--accent); color: var(--accent-ink); transform: scale(1.03); }
.board-tabs .seg-target.drop-hover .count { color: var(--accent-ink); }
.board {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 calc(-1 * var(--gutter)); gap: 0;
}
.board::-webkit-scrollbar { display: none; }
.column { flex: 0 0 100%; scroll-snap-align: start; padding: 0 var(--gutter); min-width: 0; display: flex; flex-direction: column; }
.col-head { display: none; }
.col-list { display: flex; flex-direction: column; gap: 8px; min-height: 120px; padding-bottom: 24px; flex: 1; }
.col-empty { color: var(--text-3); font-size: 14px; text-align: center; padding: 32px 12px; border: 1px dashed var(--sep-strong); border-radius: var(--r); }
.col-list:has(.task) .col-empty { display: none; }
@media (min-width: 900px) {
  .board-tabs { display: none; }
  .board { overflow: visible; margin: 0; gap: 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .column { padding: 12px; background: var(--fill); background: color-mix(in srgb, var(--fill) 55%, transparent); border-radius: 14px; }
  .col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 12px; }
  .col-head h2 { font-size: 15px; font-weight: 600; }
  .col-head .count { color: var(--text-2); font-size: 14px; font-variant-numeric: tabular-nums; }
  .col-head .icon-btn { margin-left: auto; width: 32px; height: 32px; }
  .col-head .icon-btn .icon { width: 18px; height: 18px; }
  .column.drop-hover { background: var(--accent-soft); }
}

.task {
  background: var(--surface); border-radius: var(--r); padding: 12px 14px; cursor: grab;
  display: flex; flex-direction: column; gap: 8px; position: relative;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  box-shadow: 0 0.5px 0 var(--sep); transition: box-shadow .15s, transform .15s;
  touch-action: manipulation;
}
@media (hover: hover) { .task:hover { box-shadow: 0 0 0 0.5px var(--sep-strong), 0 2px 8px rgba(0,0,0,.06); } }
.task.pressing { transform: scale(0.98); }
.task-title { font-size: 15px; font-weight: 600; line-height: 1.3; word-break: break-word; }
.task.done .task-title { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--text-3); }
.task-desc { font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.task-meta .grow { flex: 1; }
.task-meta .meta-item { display: inline-flex; align-items: center; gap: 4px; }
.task-meta .icon { width: 14px; height: 14px; }
.task-meta .overdue { color: var(--red); font-weight: 600; }
.task-company { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: 0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.task-placeholder { opacity: 0.35; box-shadow: inset 0 0 0 1.5px var(--accent-text); }
.drag-ghost {
  position: fixed; top: 0; left: 0; z-index: 300; pointer-events: none; margin: 0;
  box-shadow: var(--shadow-lift); transform-origin: center; cursor: grabbing;
}
body.dragging, body.dragging * { cursor: grabbing !important; }
.hint { font-size: 13px; color: var(--text-2); text-align: center; padding: 4px 0 12px; }
@media (min-width: 900px) { .hint.mobile { display: none; } }
@media (max-width: 899px) { .hint.desktop { display: none; } }

/* ---------- Task detail ---------- */
.detail-head { display: flex; flex-direction: column; gap: 10px; }
.detail-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; word-break: break-word; }
.detail-desc { white-space: pre-wrap; word-break: break-word; font-size: 15px; }
.kv { display: grid; grid-template-columns: auto 1fr; }
.kv .row { min-height: 46px; }
.kv-list .row-end { color: var(--text); }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.quick .btn { flex-direction: column; gap: 4px; min-height: 64px; font-size: 13px; font-weight: 500; background: var(--surface); color: var(--accent-text); border-radius: var(--r); }
.quick .btn .icon { width: 22px; height: 22px; }
.quick .btn.danger { color: var(--red); }
.timeline { display: flex; flex-direction: column; gap: 12px; }
.ev { display: flex; gap: 10px; align-items: flex-start; }
.ev-body { flex: 1; min-width: 0; }
.ev-meta { font-size: 12px; color: var(--text-2); display: flex; gap: 6px; }
.ev-meta strong { color: var(--text); font-weight: 600; }
.ev.remark .bubble { background: var(--surface); border-radius: 4px 14px 14px 14px; padding: 9px 12px; margin-top: 3px; white-space: pre-wrap; word-break: break-word; font-size: 15px; }
.ev.system { align-items: center; font-size: 13px; color: var(--text-2); padding-left: 6px; }
.ev.system .dot { margin: 0 10px 0 8px; }
.composer { display: flex; gap: 8px; align-items: flex-end; width: 100%; }
.composer textarea { min-height: 44px; max-height: 140px; resize: none; border-radius: 22px; padding: 11px 16px; }
.composer .icon-btn { flex: none; }
.composer .icon-btn:not(.filled) { width: 40px; }
.composer .icon-btn[hidden], .composer[hidden] { display: none; }

/* Remark composer: pending attachments and voice recorder */
.composer-wrap { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.tray { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-top: 2px; }
.tray[hidden] { display: none; }
.tray-item {
  position: relative; flex: none; height: 56px; border-radius: 10px; background: var(--fill);
  display: inline-flex; align-items: center; gap: 6px; padding: 0 30px 0 12px; font-size: 13px; color: var(--text); max-width: 220px;
}
.tray-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-item .icon { width: 18px; height: 18px; color: var(--text-2); flex: none; }
.tray-item.image { width: 56px; padding: 0; overflow: hidden; }
.tray-item.image img { width: 100%; height: 100%; object-fit: cover; }
.tray-item.uploading > :not(.tray-x):not(.tray-spin) { opacity: .45; }
.tray-spin { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px; border-radius: 50%; border: 2px solid var(--text-2); border-right-color: transparent; animation: spin .7s linear infinite; }
.tray-x {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; background: rgba(0,0,0,.55); color: #fff; cursor: pointer;
}
.tray-x::before { content: ""; position: absolute; inset: -11px; } /* 44pt hit area */
.tray-x .icon { width: 12px; height: 12px; color: #fff; }
.recorder { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.recorder[hidden] { display: none; }
.recorder .grow { flex: 1; font-size: 15px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: rec 1.2s ease-in-out infinite; }
.rec-time { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 44px; }
@keyframes rec { 50% { opacity: .25; } }

/* Remark attachments */
.atts { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-width: 420px; }
.att-images { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.att-images.one { grid-template-columns: minmax(0, 240px); }
.att-image { padding: 0; border: 0; background: var(--fill); border-radius: 10px; overflow: hidden; aspect-ratio: 1; cursor: zoom-in; }
.att-images.one .att-image { aspect-ratio: 4 / 3; }
.att-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.voice { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 14px; padding: 6px 14px 6px 6px; max-width: 300px; }
.voice-play {
  width: 36px; height: 36px; border-radius: 50%; border: 0; flex: none; cursor: pointer;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink);
}
.voice-play::before { content: ""; position: absolute; width: 44px; height: 44px; }
.voice-play .icon { width: 16px; height: 16px; }
.voice-play svg path { fill: currentColor; }
.voice-track { flex: 1; height: 4px; border-radius: 2px; background: var(--fill-2); overflow: hidden; min-width: 80px; }
.voice-fill { display: block; height: 100%; width: 0; background: var(--accent-text); transition: width .25s linear; }
.voice-time { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 32px; text-align: right; }
.att-link {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 12px; padding: 10px 14px; min-height: 44px; color: var(--text);
}
.att-link .icon { color: var(--accent-text); width: 18px; height: 18px; flex: none; }
.att-link .row-main span { color: var(--accent-text); font-weight: 500; }
.bubble a { text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.photo-full { display: block; width: 100%; height: auto; max-height: 70dvh; object-fit: contain; border-radius: 10px; background: var(--fill); }

/* ---------- Attendance ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { font-size: 11px; font-weight: 600; color: var(--text-3); text-align: center; padding: 4px 0; text-transform: uppercase; }
.cal-day {
  aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 15px; font-variant-numeric: tabular-nums; background: none; border: 0; color: var(--text); padding: 0;
}
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--accent-text); font-weight: 700; }
.cal-day .code { font-size: 10px; font-weight: 700; letter-spacing: 0.02em; line-height: 1; min-height: 10px; }
.code-P { color: var(--green); } .code-H { color: var(--orange); } .code-A { color: var(--red); }
.code-L, .code-U { color: var(--accent-text); } .code-WO, .code-HO, .code-NJ { color: var(--text-3); }
.cal-day.bg-P { background: var(--green-soft); } .cal-day.bg-H { background: var(--orange-soft); } .cal-day.bg-A { background: var(--red-soft); }
.cal-day.bg-L, .cal-day.bg-U { background: var(--accent-soft); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); margin-top: 12px; }
.legend b { font-weight: 700; margin-right: 3px; }

.register-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--r); -webkit-overflow-scrolling: touch; }
table.register { border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.register th, .register td { padding: 0; text-align: center; border-bottom: 0.5px solid var(--sep); height: 44px; min-width: 34px; }
.register thead th { font-size: 11px; color: var(--text-2); font-weight: 600; height: 48px; line-height: 1.2; }
.register thead th.off { color: var(--text-3); }
.register th.name { position: sticky; left: 0; background: var(--surface); text-align: left; padding: 0 12px 0 16px; min-width: 150px; max-width: 170px; z-index: 1; border-right: 0.5px solid var(--sep); }
.register th.name strong { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.register th.name small { color: var(--text-2); font-size: 12px; font-weight: 400; }
.register td button { width: 100%; height: 100%; min-height: 44px; border: 0; background: none; font-weight: 700; font-size: 12px; cursor: pointer; position: relative; }
.register td button:hover { background: var(--fill); }
.register td button.late::after { content: ""; position: absolute; top: 6px; right: 6px; width: 4px; height: 4px; border-radius: 50%; background: var(--orange); }
.register td button.ovr { text-decoration: underline; text-underline-offset: 3px; }
.register td.sum { font-weight: 600; min-width: 44px; padding: 0 6px; }
.register tbody tr:last-child td, .register tbody tr:last-child th { border-bottom: 0; }

/* ---------- Workflows ---------- */
.wf { display: flex; flex-direction: column; gap: 12px; cursor: pointer; }
.wf-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.wf-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.wf-sched { font-size: 14px; color: var(--text-2); margin-top: 2px; }
.wf-people { display: flex; flex-direction: column; border-top: 0.5px solid var(--sep); }
.wf-person { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; }
.wf-person + .wf-person { border-top: 0.5px solid var(--sep); }
.wf-person .grow { flex: 1; min-width: 0; }
.wf-person .time { font-variant-numeric: tabular-nums; font-weight: 600; }
.wf-person small { color: var(--text-2); font-size: 12px; display: block; }
.wf.inactive { opacity: 0.6; }
.grid-cards { display: grid; gap: 12px; }
@media (min-width: 760px) { .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .grid-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.assignee-row { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 16px; min-height: 52px; }
.assignee-row + .assignee-row { border-top: 0.5px solid var(--sep); }
.assignee-row label.who { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; min-height: 44px; }
.assignee-row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.assignee-row input[type=time] { width: 116px; flex: none; min-height: 38px; padding: 6px 10px; }
.assignee-row input[type=time]:disabled { opacity: 0.35; }

/* ---------- Payroll ---------- */
.money-big { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.slip-lines .row { min-height: 44px; }
.slip-lines .row-end { color: var(--text); font-variant-numeric: tabular-nums; }
.slip-lines .row.total { font-weight: 700; }
.slip-lines .row.total .row-end { font-weight: 700; }

.printable { display: none; }
@media print {
  @page { size: A4; margin: 16mm; }
  body { background: #fff !important; color: #000 !important; }
  body > *:not(.print-root) { display: none !important; }
  .print-root { display: block !important; }
}
.payslip-doc { background: #fff; color: #111; max-width: 780px; margin: 0 auto; padding: 40px; border-radius: var(--r); font-size: 13px; line-height: 1.5; }
.payslip-doc .slip-logo { filter: none !important; width: 120px; }
.payslip-doc header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid #111; padding-bottom: 16px; margin-bottom: 20px; gap: 16px; }
.payslip-doc h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.payslip-doc .doc-meta { text-align: right; color: #555; }
.payslip-doc .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; margin-bottom: 20px; }
.payslip-doc .grid2 div { display: flex; justify-content: space-between; border-bottom: 0.5px solid #ddd; padding: 4px 0; gap: 12px; }
.payslip-doc .grid2 span { color: #555; }
.payslip-doc table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-variant-numeric: tabular-nums; }
.payslip-doc th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #555; border-bottom: 1px solid #111; padding: 6px 0; }
.payslip-doc td { padding: 6px 0; border-bottom: 0.5px solid #ddd; }
.payslip-doc td.r, .payslip-doc th.r { text-align: right; }
.payslip-doc .net { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid #111; border-bottom: 1px solid #111; padding: 12px 0; font-size: 16px; font-weight: 700; }
.payslip-doc footer { margin-top: 28px; color: #777; font-size: 11px; }
@media (max-width: 600px) {
  .payslip-doc { padding: 20px; font-size: 12px; }
  .payslip-doc .grid2 { grid-template-columns: 1fr; }
}

/* ---------- Misc ---------- */
.split { display: grid; gap: 28px; }
@media (min-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 24px; } }
.kicker { font-size: 13px; color: var(--text-2); font-weight: 500; }
.profile-head { display: flex; align-items: center; gap: 14px; padding: 4px 0 16px; }
.profile-head h3 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.inline-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.map-link { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; }
.map-link .icon { width: 14px; height: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
