:root {
  --navy: #0D1820;
  --panel: #14232C;
  --raised: #1B2E39;
  --line: #24394550;
  --line-strong: #2A4351;
  --teal: #3FC6A8;
  --teal-ink: #062A22;
  --teal-soft: #3FC6A81F;
  --coral: #F2806E;
  --coral-soft: #F2806E1F;
  --amber: #E9B65A;
  --amber-soft: #E9B65A1F;
  --text: #E4ECF0;
  --muted: #8DA1AD;
  --faint: #5E7581;
  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 16px;
  --font: 'Sora', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--navy); color: var(--text);
  font: 400 14px/1.55 var(--font);
  font-feature-settings: 'tnum' 1;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; margin: 0; line-height: 1.25; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.logo svg { height: 22px; width: auto; display: block; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--line-strong);
  padding: 22px 14px; display: flex; flex-direction: column; gap: 22px;
}
.sidebar .logo { padding: 0 10px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { color: var(--faint); font-size: 12px; padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-s);
  color: var(--muted); font-weight: 500;
}
.nav a:hover { color: var(--text); background: var(--raised); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--raised); box-shadow: inset 3px 0 0 var(--teal); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .badge { margin-left: auto; }
.me-box { margin-top: auto; padding: 12px; border-top: 1px solid var(--line-strong); display: flex; flex-direction: column; gap: 6px; }
.me-box .name { font-weight: 600; }
.linklike { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; text-align: left; font-size: 13px; }
.linklike:hover { color: var(--text); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 32px; border-bottom: 1px solid var(--line-strong);
  position: sticky; top: 0; background: var(--navy); z-index: 20;
}
.topbar .mobile-logo { display: none; }
.clock { display: flex; align-items: baseline; gap: 8px; color: var(--muted); font-size: 13px; }
.clock strong { color: var(--text); font-weight: 600; font-size: 15px; }
.top-right { display: flex; align-items: center; gap: 14px; }
.content { padding: 28px 32px 60px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-strong); background: var(--raised); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius-s); cursor: pointer; font-weight: 500; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: var(--teal-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { border-color: #F2806E66; color: var(--coral); background: transparent; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.icon-btn {
  position: relative; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { color: var(--text); border-color: var(--muted); }
.icon-btn svg { width: 18px; height: 18px; }
.dot-count {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--coral); color: #2A0D08; font-size: 11px; font-weight: 700; display: grid; place-items: center;
}
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=date], input[type=time], input[type=month], input[type=datetime-local], select, textarea {
  background: var(--navy); border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  padding: 9px 11px; color: var(--text); width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); }
textarea { resize: vertical; min-height: 80px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-s); overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 7px 13px; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { background: var(--raised); color: var(--text); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; }

/* ---------- surfaces ---------- */
.panel { background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 20px; }
.panel + .panel { margin-top: 18px; }
.grid-2 > .panel, .grid-3 > .panel { margin-top: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); margin-bottom: 22px; }
.stat { padding: 18px 20px; border-right: 1px solid var(--line-strong); }
.stat:last-child { border-right: 0; }
.stat .v { font-size: 26px; font-weight: 600; line-height: 1.2; }
.stat .l { color: var(--muted); font-size: 13px; }
.stat a { color: inherit; }
.stat.alert .v { color: var(--coral); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line-strong); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; background: var(--raised); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--raised); color: var(--muted); white-space: nowrap; }
.pill.teal { background: var(--teal-soft); color: var(--teal); }
.pill.coral { background: var(--coral-soft); color: var(--coral); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--teal); color: var(--teal-ink); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.presence { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.presence.on { background: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }

/* ---------- check-in hero ---------- */
.shift-hero {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: center;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-l);
  padding: 34px 38px; margin-bottom: 22px;
}
.shift-hero .greet { color: var(--muted); margin-bottom: 4px; }
.big-clock { font-size: clamp(48px, 7vw, 84px); font-weight: 300; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.big-clock .sec { color: var(--faint); font-size: .42em; letter-spacing: 0; margin-left: 6px; }
.shift-state { margin-top: 18px; font-size: 15px; }
.shift-state strong { font-weight: 600; }
.checkin-row { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.checkin-btn { padding: 15px 30px; font-size: 16px; border-radius: var(--radius); }
.arc-wrap { position: relative; width: 100%; max-width: 320px; justify-self: end; }
.arc-wrap svg { width: 100%; height: auto; display: block; }
.arc-label { position: absolute; inset: auto 0 6% 0; text-align: center; }
.arc-label .v { font-size: 22px; font-weight: 600; }
.arc-label .l { color: var(--muted); font-size: 12.5px; }
.server-note { color: var(--faint); font-size: 12px; margin-top: 14px; }

/* ---------- list rows ---------- */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-strong); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 600; font-size: 13px; color: var(--navy); position: relative;
}
.avatar .presence { position: absolute; right: -1px; bottom: -1px; border: 2px solid var(--panel); width: 11px; height: 11px; box-shadow: none; }

/* ---------- chat ---------- */
.chat { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: calc(100vh - 73px); border-top: 0; }
.content.flush { padding: 0; max-width: none; }
.chat-list { border-right: 1px solid var(--line-strong); display: flex; flex-direction: column; min-height: 0; }
.chat-list-head { padding: 16px; display: flex; gap: 8px; border-bottom: 1px solid var(--line-strong); }
.chat-items { overflow-y: auto; flex: 1; }
.chat-item { display: flex; gap: 11px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--line); align-items: center; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.chat-item:hover { background: var(--panel); }
.chat-item.active { background: var(--raised); }
.chat-item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .s { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 11.5px; color: var(--faint); }
.group-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--raised); border: 1px solid var(--line-strong); display: grid; place-items: center; color: var(--teal); flex: none; font-weight: 600; }
.thread { display: flex; flex-direction: column; min-height: 0; position: relative; }
.thread-head { padding: 14px 22px; border-bottom: 1px solid var(--line-strong); display: flex; align-items: center; gap: 12px; }
.thread-head .grow { flex: 1; min-width: 0; }
.thread-head .sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back-btn { display: none; }
.messages { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 2px; }
.day-sep { text-align: center; color: var(--faint); font-size: 12px; margin: 14px 0 8px; }
.msg { display: flex; gap: 10px; max-width: 78%; position: relative; padding: 2px 0; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble-col { display: flex; flex-direction: column; min-width: 0; }
.msg.mine .bubble-col { align-items: flex-end; }
.msg .who { font-size: 12px; color: var(--muted); margin: 6px 2px 3px; }
.bubble { background: var(--raised); border-radius: 4px 14px 14px 14px; padding: 8px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine .bubble { background: #1F4A47; border-radius: 14px 4px 14px 14px; }
.msg .time { font-size: 11px; color: var(--faint); margin: 3px 4px 0; }
.msg.cont .who, .msg.cont .avatar { visibility: hidden; height: 0; }
.msg.cont .avatar { height: 0; }
.bubble img { display: block; max-width: min(320px, 100%); max-height: 300px; border-radius: 8px; margin: 2px 0; cursor: zoom-in; }
.file-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: #0D182066; color: var(--text); margin: 2px 0; }
.file-chip svg { width: 20px; height: 20px; color: var(--teal); flex: none; }
.file-chip .fs { color: var(--muted); font-size: 12px; }
.react-bar {
  position: absolute; top: 50%; transform: translateY(-50%); display: none; gap: 2px; background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 3px 5px; z-index: 5; box-shadow: 0 6px 18px #00000055;
}
.msg:not(.mine) .react-bar { left: calc(100% + 6px); }
.msg.mine .react-bar { right: calc(100% + 6px); }
.react-bar::before { content: ''; position: absolute; top: 0; bottom: 0; width: 12px; }
.msg:not(.mine) .react-bar::before { left: -12px; }
.msg.mine .react-bar::before { right: -12px; }
.msg:hover .react-bar, .msg:focus-within .react-bar { display: flex; }
.react-bar button { background: none; border: 0; font-size: 17px; cursor: pointer; padding: 2px 4px; border-radius: 6px; line-height: 1.2; }
.react-bar button:hover { background: var(--raised); transform: scale(1.15); }
.reactions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.reactions button { background: var(--panel); border: 1px solid var(--line-strong); border-radius: 999px; padding: 1px 8px; font-size: 13px; cursor: pointer; color: var(--muted); }
.reactions button.mine { border-color: var(--teal); color: var(--text); background: var(--teal-soft); }
.seen { font-size: 11.5px; color: var(--faint); align-self: flex-end; margin: 2px 4px 6px; }
.typing { font-size: 12px; color: var(--muted); padding: 0 22px 6px; min-height: 20px; }
.composer { border-top: 1px solid var(--line-strong); padding: 12px 16px; display: flex; gap: 8px; align-items: flex-end; position: relative; }
.composer textarea { min-height: 42px; max-height: 160px; resize: none; padding: 10px 12px; border-radius: var(--radius); }
.composer .icon-btn { width: 40px; height: 40px; border-radius: var(--radius); flex: none; }
.composer .send { height: 42px; }
.attach-preview { position: absolute; bottom: 100%; left: 16px; right: 16px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 10px; display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.attach-preview img { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; }
.emoji-pop {
  position: absolute; bottom: calc(100% + 6px); left: 16px; background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 8px; display: grid; grid-template-columns: repeat(8, 36px); gap: 2px; z-index: 30; box-shadow: 0 10px 28px #00000066;
}
.emoji-pop button { background: none; border: 0; font-size: 21px; width: 36px; height: 36px; border-radius: 6px; cursor: pointer; }
.emoji-pop button:hover { background: var(--raised); }
.drop-hint { position: absolute; inset: 0; background: #0D1820D9; border: 2px dashed var(--teal); display: grid; place-items: center; font-size: 16px; z-index: 40; border-radius: 4px; }
.chat-empty { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; padding: 30px; }

/* ---------- dropdown / modal / toast ---------- */
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); width: 360px; max-height: 460px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 16px 40px #00000077; z-index: 50;
}
.dropdown .dh { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line-strong); }
.note { padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; display: block; color: var(--text); }
.note:hover { background: var(--raised); text-decoration: none; }
.note.unread { box-shadow: inset 3px 0 0 var(--teal); }
.note .nt { font-weight: 600; font-size: 13.5px; }
.note .nb { color: var(--muted); font-size: 12.5px; }
.note .nw { color: var(--faint); font-size: 11.5px; margin-top: 2px; }
.modal-back { position: fixed; inset: 0; background: #050B0FCC; display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-l); width: min(560px, 100%); max-height: 90vh; overflow-y: auto; padding: 24px; }
.modal.wide { width: min(760px, 100%); }
.modal h2 { margin-bottom: 16px; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 8px; display: block; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--raised); border: 1px solid var(--line-strong); border-left: 3px solid var(--teal); padding: 11px 16px; border-radius: var(--radius-s); max-width: 360px; box-shadow: 0 10px 30px #00000066; }
.toast.err { border-left-color: var(--coral); }
.secret { font-size: 20px; font-weight: 600; letter-spacing: 0.06em; background: var(--navy); border: 1px dashed var(--teal); padding: 12px 16px; border-radius: var(--radius-s); text-align: center; margin: 10px 0; user-select: all; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { position: relative; overflow: hidden; border-right: 1px solid var(--line-strong); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art .logo svg { height: 30px; }
.login-art .line { font-size: clamp(28px, 3.4vw, 44px); font-weight: 300; line-height: 1.15; letter-spacing: -0.02em; max-width: 14ch; }
.login-art .foot { color: var(--faint); font-size: 12.5px; }
.login-art svg.rings { position: absolute; right: -120px; bottom: -120px; width: 520px; opacity: .9; pointer-events: none; }
.login-form { display: grid; place-items: center; padding: 32px; }
.login-form form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 16px; }
.err-box { background: var(--coral-soft); color: var(--coral); border-radius: var(--radius-s); padding: 10px 12px; font-size: 13px; }
.blocked { max-width: 460px; text-align: center; margin: 14vh auto; padding: 24px; }
.blocked .icon { width: 56px; height: 56px; border-radius: 50%; background: var(--coral-soft); color: var(--coral); display: grid; place-items: center; margin: 0 auto 18px; }

/* ---------- salary slip ---------- */
.slip { background: #F7FAFA; color: #10202A; border-radius: var(--radius); padding: 30px 34px; max-width: 680px; }
.slip .logo { color: #10202A; }
.slip-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 18px; border-bottom: 2px solid #10202A; margin-bottom: 18px; }
.slip-head .t { text-align: right; }
.slip-head .t strong { display: block; font-size: 18px; }
.slip-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; margin-bottom: 18px; font-size: 13px; }
.slip-meta span { color: #5B6E79; }
.slip table th { background: #E6EEF0; color: #10202A; }
.slip table td, .slip table th { border-color: #D3DFE3; }
.slip .net { display: flex; justify-content: space-between; align-items: baseline; margin-top: 16px; padding: 14px 16px; background: #10202A; color: #fff; border-radius: 8px; }
.slip .net strong { font-size: 22px; }
.slip .foot { color: #5B6E79; font-size: 11.5px; margin-top: 16px; }
.slip-card { display: flex; flex-direction: column; gap: 14px; }

/* ---------- mobile ---------- */
.tabbar { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 12px 16px; }
  .topbar .mobile-logo { display: inline-flex; }
  .topbar .mobile-logo svg { height: 16px; }
  .msg .react-bar { top: auto; bottom: 100%; transform: none; }
  .msg:not(.mine) .react-bar { left: 0; }
  .msg.mine .react-bar { right: 0; }
  .topbar .clock .lbl { display: none; }
  .content { padding: 20px 16px 96px; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60; background: var(--panel);
    border-top: 1px solid var(--line-strong); overflow-x: auto; padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { flex: 1 1 0; min-width: 0; white-space: nowrap; font-size: 10.5px !important; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; color: var(--muted); font-size: 11px; position: relative; }
  .tabbar a.active { color: var(--teal); }
  .tabbar a:hover { text-decoration: none; }
  .tabbar svg { width: 20px; height: 20px; }
  .tabbar .badge { position: absolute; top: 3px; right: calc(50% - 22px); min-width: 16px; height: 16px; font-size: 10px; }
  .shift-hero { grid-template-columns: 1fr; padding: 24px; }
  .arc-wrap { justify-self: center; max-width: 260px; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .stat { border-right: 0; border-bottom: 1px solid var(--line-strong); }
  .chat { grid-template-columns: 1fr; height: calc(100vh - 61px - 58px); }
  .chat.in-thread .chat-list { display: none; }
  .chat:not(.in-thread) .thread { display: none; }
  .back-btn { display: grid; }
  .msg { max-width: 92%; }
  .login-page { grid-template-columns: 1fr; }
  .login-art { min-height: 220px; padding: 28px; }
  .login-art .line { font-size: 26px; }
  .dropdown { position: fixed; left: 12px; right: 12px; width: auto; top: 64px; }
  .slip { padding: 22px 18px; }
  .slip-meta { grid-template-columns: 1fr; }
}

/* ================= v2: tasks, mail, documents ================= */
.mobile-only { display: none; }
.content.wide-view { max-width: none; }
.swatch { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }
.swatch.lg { width: 14px; height: 14px; border-radius: 4px; }
.proj-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.due { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.due svg { width: 13px; height: 13px; }
.due.soon { color: var(--amber); }
.due.late { color: var(--coral); font-weight: 600; }
.x { background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 17px; line-height: 1; padding: 0 4px; }
.x:hover { color: var(--coral); }
.check-field { flex-direction: column; }
.check-field input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--teal); }
.alias-wrap { display: flex; align-items: center; gap: 6px; }
.alias-wrap input { flex: 1; }
.click-row { cursor: pointer; }
.click-row:hover td { background: var(--raised); }
.status-sel { width: auto; padding: 4px 8px; font-size: 12.5px; }
.status-sel.s-done { color: var(--teal); }
.status-sel.s-in_progress { color: #7FB4E6; }
.status-sel.s-review { color: var(--amber); }

/* board */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.board-col { background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 10px; min-height: 160px; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s; }
.board-col.over { border-color: var(--teal); background: #14232CEE; }
.board-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 6px; }
.board-head .faint { margin-left: auto; font-size: 12.5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.dot.s-in_progress { background: #7FB4E6; } .dot.s-review { background: var(--amber); } .dot.s-done { background: var(--teal); }
.board-list { display: flex; flex-direction: column; gap: 8px; min-height: 20px; }
.task-card { background: var(--raised); border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px; cursor: grab; display: flex; flex-direction: column; gap: 6px; }
.task-card:hover { border-color: var(--muted); }
.task-card.dragging { opacity: .4; }
.task-card.done .tc-title { color: var(--muted); text-decoration: line-through; }
.tc-proj { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-title { font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.tc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tc-meta .avatar { width: 24px; height: 24px; font-size: 10.5px; }
.quick-add { background: transparent !important; border-style: dashed !important; font-size: 13px; }

/* task detail */
.task-modal { width: min(980px, 100%) !important; }
.td-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.td-top .icon-btn { font-size: 20px; }
.td-title { font-size: 20px; font-weight: 600; background: transparent !important; border-color: transparent !important; padding: 6px 8px !important; margin: 0 -8px 10px; }
.td-title:hover:not(:disabled), .td-title:focus { border-color: var(--line-strong) !important; }
.td-grid { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 24px; }
.td-side { display: flex; flex-direction: column; gap: 12px; border-left: 1px solid var(--line-strong); padding-left: 20px; }
.td-desc { min-height: 110px; }
.td-block { margin-top: 20px; }
.td-block summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.progress { height: 5px; background: var(--navy); border-radius: 3px; overflow: hidden; margin-bottom: 8px; }
.progress span { display: block; height: 100%; background: var(--teal); }
.ck-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ck-row input { width: 16px; height: 16px; accent-color: var(--teal); }
.ck-row.done .grow { color: var(--faint); text-decoration: line-through; }
.cm { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cm .avatar { width: 30px; height: 30px; font-size: 11.5px; }
.cm .grow { flex: 1; min-width: 0; }
.cm-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 3px; }
.cm-new { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.att-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--raised); border: 1px solid var(--line-strong); border-radius: 8px; padding: 5px 9px; max-width: 100%; font-size: 13px; }
.att-chip img { width: 36px; height: 36px; object-fit: cover; border-radius: 5px; cursor: zoom-in; }
.att-chip .ic { width: 18px; color: var(--teal); display: inline-flex; }
.att-chip a { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }

/* mail */
.mail { display: grid; grid-template-columns: 210px 360px minmax(0, 1fr); height: calc(100vh - 73px); }
.mail-side { border-right: 1px solid var(--line-strong); padding: 16px 12px; display: flex; flex-direction: column; gap: 14px; }
.mail-folders { display: flex; flex-direction: column; gap: 2px; }
.mail-folders a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-s); color: var(--muted); }
.mail-folders a:hover { background: var(--raised); color: var(--text); text-decoration: none; }
.mail-folders a.active { background: var(--raised); color: var(--text); box-shadow: inset 3px 0 0 var(--teal); }
.mail-folders svg { width: 17px; height: 17px; }
.mail-folders .grow { flex: 1; }
.mail-addr { margin-top: auto; padding: 0 6px; word-break: break-all; }
.mail-list { border-right: 1px solid var(--line-strong); display: flex; flex-direction: column; min-height: 0; }
.mail-list-head { padding: 12px; border-bottom: 1px solid var(--line-strong); }
.mail-items { overflow-y: auto; flex: 1; }
.mail-item { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 12px 16px; cursor: pointer; color: var(--muted); }
.mail-item:hover { background: var(--panel); }
.mail-item.active { background: var(--raised); }
.mail-item.unread { color: var(--text); box-shadow: inset 3px 0 0 var(--teal); }
.mail-item.unread .mi-from, .mail-item.unread .mi-subj { font-weight: 600; }
.mi-top { display: flex; justify-content: space-between; gap: 10px; }
.mi-from { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-date { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.mi-subj { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; display: flex; gap: 6px; align-items: center; }
.mi-star { width: 14px; display: inline-flex; }
.mi-prev { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-reader { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.mail-head { display: flex; align-items: center; gap: 8px; padding: 14px 22px; border-bottom: 1px solid var(--line-strong); flex-wrap: wrap; position: sticky; top: 0; background: var(--navy); z-index: 2; }
.mail-head .icon-btn svg { width: 17px; }
.mail-thread { padding: 10px 22px; display: flex; flex-direction: column; gap: 10px; }
.mail-msg { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--panel); }
.mm-head { display: flex; gap: 12px; align-items: center; padding: 12px 16px; cursor: pointer; }
.mm-head .grow { flex: 1; min-width: 0; }
.mm-body { display: none; padding: 4px 16px 16px 62px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.mm-atts { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 14px 62px; }
.mail-msg:not(.open) .mm-atts { display: none; }
.mail-msg.open .mm-body { display: block; }
.mail-actions { padding: 6px 22px 30px; }
.compose-grid { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.compose-grid > .mm-atts { padding: 0; }
.compose-from { margin-top: -8px; }
.recip { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--navy); border: 1px solid var(--line-strong); border-radius: var(--radius-s); padding: 5px 8px; position: relative; }
.recip:focus-within { border-color: var(--teal); }
.recip input { border: 0 !important; background: transparent !important; flex: 1; min-width: 160px; padding: 4px 2px !important; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--raised); border: 1px solid var(--line-strong); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 13px; color: var(--text); }
.sugg { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); z-index: 20; box-shadow: 0 12px 30px #00000066; max-height: 280px; overflow-y: auto; }
.sugg button { display: flex; gap: 10px; align-items: center; width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; text-align: left; cursor: pointer; color: var(--text); }
.sugg button:hover { background: var(--raised); }

/* documents */
.docs { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.docs-side { background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 12px 6px; display: flex; flex-direction: column; gap: 2px; }
.df { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-s); color: var(--muted); }
.df:hover { background: var(--raised); color: var(--text); text-decoration: none; }
.df.active { background: var(--raised); color: var(--text); box-shadow: inset 3px 0 0 var(--teal); }
.df svg { width: 17px; height: 17px; flex: none; }
.df .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-main { min-width: 0; border-radius: var(--radius); }
.docs-main.drop { outline: 2px dashed var(--teal); outline-offset: 4px; }
.docs-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.docs-head .grow { flex: 1; }
.doc-name { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 500; }
.doc-ic { width: 18px; color: var(--teal); display: inline-flex; flex: none; }

@media (max-width: 1100px) {
  .mail { grid-template-columns: 180px minmax(0, 1fr); }
  .mail .mail-reader { display: none; }
  .mail.reading .mail-list { display: none; }
  .mail.reading .mail-reader { display: flex; }
  .mail .back-btn { display: grid; }
}
@media (max-width: 900px) {
  .tabbar a { min-width: 62px; }
  .board { grid-template-columns: repeat(4, 82vw); scroll-snap-type: x mandatory; }
  .board-col { scroll-snap-align: start; }
  .td-grid { grid-template-columns: 1fr; }
  .td-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--line-strong); padding-top: 14px; }
  .mail { grid-template-columns: 1fr; height: calc(100vh - 61px - 58px); }
  .mail-side { display: none; }
  .mobile-only { display: flex; }
  .mail:not(.reading) .mail-list { display: flex; }
  .mail-list-head::before { content: none; }
  .mm-body, .mm-atts { padding-left: 16px; }
  .docs { grid-template-columns: 1fr; }
}


/* ================= v2.1: sales forms ================= */
.nowrap { white-space: nowrap; }
.stat-mini { display: flex; flex-direction: column; align-items: flex-end; }
.stat-mini strong { font-size: 26px; font-weight: 600; line-height: 1.1; color: var(--teal); }
.sale-form { margin-top: 4px; }
.sales-table table { font-size: 13px; }
.sales-table th, .sales-table td { padding: 8px 10px; }
.sales-table td.clip { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sales-table tr.hl td { background: #E9B65A2E !important; }
.payout-in { width: 92px !important; padding: 5px 8px !important; }
.status-sel.sale-billable { color: var(--teal); } .status-sel.sale-pending { color: var(--amber); } .status-sel.sale-not_billable, .status-sel.sale-returned { color: var(--coral); }
.sm-ic { width: 30px; height: 30px; font-size: 14px; margin-right: 4px; display: inline-flex !important; vertical-align: middle; }
.agent-strip { display: flex; gap: 8px; flex-wrap: wrap; margin: -8px 0 16px; }
.agent-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 12px 4px 4px; font-size: 13px; }
.agent-chip .avatar { width: 26px; height: 26px; font-size: 10.5px; }
.form-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.form-cards .panel + .panel { margin-top: 0; }
.form-card.off { opacity: .65; }
.switch { position: relative; width: 42px; height: 24px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--raised); border: 1px solid var(--line-strong); border-radius: 12px; transition: .15s; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: var(--muted); border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: var(--teal-soft); border-color: var(--teal); }
.switch input:checked + span::before { transform: translateX(18px); background: var(--teal); }
.builder-modal { width: min(1040px, 100%) !important; }
.fb-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 20px; }
.fb-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.fb-row { display: flex; gap: 8px; background: var(--raised); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px; }
.fb-move { display: flex; flex-direction: column; justify-content: center; }
.fb-move .x { font-size: 11px; }
.fb-move .x:disabled { opacity: .25; cursor: default; }
.fb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.fb-line { display: flex; gap: 6px; align-items: center; }
.fb-line input[type=text] { flex: 1; }
.fb-line select { width: auto; }
.fb-req { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.fb-req input { accent-color: var(--teal); }
.fb-preview .field { pointer-events: none; }
@media (max-width: 900px) { .fb-grid { grid-template-columns: 1fr; } .fb-line { flex-wrap: wrap; } }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .tabbar, .toasts, .no-print { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  .modal-back { position: static; background: none; padding: 0; }
  .modal { border: 0; padding: 0; max-height: none; background: #fff; }
  .slip { max-width: none; }
  .slip .net { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
