/* ================= ASIZA MMS — Apple / iOS design language ================= */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Inter, sans-serif;
  --accent: #0a84ff;
  --accent-soft: rgba(10,132,255,.12);
  --green: #30d158; --orange: #ff9f0a; --red: #ff453a; --purple: #bf5af2; --teal: #64d2ff;
  --bg: #f2f2f7;
  --bg-grad-1: rgba(10,132,255,.14);
  --bg-grad-2: rgba(191,90,242,.10);
  --bg-grad-3: rgba(48,209,88,.10);
  --card: rgba(255,255,255,.72);
  --card-solid: #ffffff;
  --card-border: rgba(255,255,255,.65);
  --stroke: rgba(60,60,67,.12);
  --text: #1c1c1e;
  --text-2: rgba(60,60,67,.62);
  --text-3: rgba(60,60,67,.35);
  --fill: rgba(120,120,128,.12);
  --fill-2: rgba(120,120,128,.2);
  --shadow: 0 8px 32px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --radius: 20px;
  --radius-s: 12px;
  --blur: saturate(180%) blur(22px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
:root { --chart-1: #0a6bd9; --chart-2: #1e9e46; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000;
    --bg-grad-1: rgba(10,132,255,.16);
    --bg-grad-2: rgba(191,90,242,.12);
    --bg-grad-3: rgba(48,209,88,.08);
    --card: rgba(28,28,30,.72);
    --card-solid: #1c1c1e;
    --card-border: rgba(255,255,255,.08);
    --stroke: rgba(84,84,88,.5);
    --text: #f2f2f7;
    --text-2: rgba(235,235,245,.6);
    --text-3: rgba(235,235,245,.3);
    --fill: rgba(120,120,128,.24);
    --fill-2: rgba(120,120,128,.36);
    --shadow: 0 8px 32px rgba(0,0,0,.5);
    --chart-1: #2f7fe0; --chart-2: #2aa14f;
  }
}
:root[data-theme="dark"] {
  --bg: #000;
  --bg-grad-1: rgba(10,132,255,.16);
  --bg-grad-2: rgba(191,90,242,.12);
  --bg-grad-3: rgba(48,209,88,.08);
  --card: rgba(28,28,30,.72);
  --card-solid: #1c1c1e;
  --card-border: rgba(255,255,255,.08);
  --stroke: rgba(84,84,88,.5);
  --text: #f2f2f7;
  --text-2: rgba(235,235,245,.6);
  --text-3: rgba(235,235,245,.3);
  --fill: rgba(120,120,128,.24);
  --fill-2: rgba(120,120,128,.36);
  --shadow: 0 8px 32px rgba(0,0,0,.5);
  --chart-1: #2f7fe0; --chart-2: #2aa14f;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--text); background: var(--bg);
  min-height: 100%; font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 50% at 12% 8%, var(--bg-grad-1), transparent 60%),
    radial-gradient(50% 40% at 88% 18%, var(--bg-grad-2), transparent 60%),
    radial-gradient(55% 45% at 50% 100%, var(--bg-grad-3), transparent 60%),
    var(--bg);
}
h1,h2,h3 { margin: 0; letter-spacing: -.02em; }
a { color: var(--accent); text-decoration: none; }
button { font-family: var(--font); }
input, select, textarea { font-family: var(--font); font-size: 16px; color: var(--text); }

/* ---------- layout shell ---------- */
#app { display: flex; min-height: 100dvh; }
.sidebar {
  width: 250px; flex: 0 0 250px; padding: 24px 14px calc(16px + var(--safe-b));
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
  background: var(--card); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-right: 1px solid var(--stroke); display: flex; flex-direction: column; gap: 4px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; flex: 0 0 38px;
  background: linear-gradient(135deg,#0a84ff,#5e5ce6); color:#fff; display:flex; align-items:center; justify-content:center;
  font-weight: 800; font-size: 15px; letter-spacing: 0; box-shadow: 0 4px 14px rgba(10,132,255,.4); }
.brand b { font-size: 17px; display:block; line-height: 1.1; }
.brand span { font-size: 11.5px; color: var(--text-2); }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radius-s);
  color: var(--text); font-weight: 500; font-size: 15px; cursor: pointer; border: 0; background: transparent;
  width: 100%; text-align: left; transition: background .15s;
}
.nav-item svg { width: 21px; height: 21px; flex: 0 0 21px; color: var(--text-2); }
.nav-item:hover { background: var(--fill); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active svg { color: var(--accent); }
.sidebar .spacer { flex: 1; }
.sidebar .userchip { display:flex; gap:10px; align-items:center; padding:10px 12px; border-radius: var(--radius-s);
  background: var(--fill); cursor: pointer; }
.userchip .avatar { width: 34px; height:34px; border-radius: 50%; background: linear-gradient(135deg,#ff9f0a,#ff453a);
  color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; flex:0 0 34px;}
.userchip b { font-size: 14px; display:block; line-height:1.15;}
.userchip span { font-size: 12px; color: var(--text-2); }

.main { flex: 1; min-width: 0; padding: 24px clamp(16px, 4vw, 44px) calc(40px + var(--safe-b)); }
.main-inner { max-width: 1080px; margin: 0 auto; }

/* mobile tab bar */
.tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 6px 8px calc(6px + var(--safe-b));
  background: var(--card); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-top: 1px solid var(--stroke);
}
.tabbar .tabs { display: flex; max-width: 560px; margin: 0 auto; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 2px; border: 0; background: transparent; color: var(--text-2);
  font-size: 10.5px; font-weight: 600; cursor: pointer; border-radius: 12px;
}
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--accent); }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .tabbar { display: block; }
  .main { padding: calc(14px + var(--safe-t)) 16px calc(96px + var(--safe-b)); }
}

/* ---------- headers ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(26px, 4vw, 34px); font-weight: 800; }
.page-head .sub { color: var(--text-2); font-size: 14.5px; margin-top: 3px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card {
  background: var(--card); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--card-border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 19px; font-weight: 700; margin-bottom: 14px; }
.card .card-sub { color: var(--text-2); font-size: 13.5px; margin: -10px 0 14px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr 1fr; } .grid.stack-sm { grid-template-columns: 1fr; } }

/* stat tiles */
.stat { padding: 16px 18px; }
.stat .n { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.stat .l { font-size: 13px; color: var(--text-2); font-weight: 600; margin-top: 2px; }
.stat.tappable { cursor: pointer; transition: transform .12s; }
.stat.tappable:active { transform: scale(.97); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; border-radius: 14px; padding: 11px 18px; font-size: 15px; font-weight: 600;
  cursor: pointer; background: var(--fill); color: var(--text); transition: transform .12s, opacity .15s;
  text-decoration: none;
}
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(10,132,255,.35); }
.btn.green { background: var(--green); color: #fff; box-shadow: 0 6px 18px rgba(48,209,88,.35); }
.btn.danger { background: rgba(255,69,58,.12); color: var(--red); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { padding: 7px 13px; font-size: 13.5px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 17px; height: 17px; }

/* segmented control */
.seg { display: inline-flex; background: var(--fill); border-radius: 12px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; }
.seg button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.seg button.active { background: var(--card-solid); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--stroke); background: var(--fill);
  border-radius: 12px; padding: 12px 14px; outline: none; transition: border .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none;
}
select.input {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3.5px var(--accent-soft); background: var(--card-solid); }
textarea.input { min-height: 90px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .form-row.stack { grid-template-columns: 1fr; } }
.hint { font-size: 12.5px; color: var(--text-3); margin-top: 5px; }

.switch { position: relative; width: 51px; height: 31px; flex: 0 0 51px; }
.switch input { display: none; }
.switch i { position: absolute; inset: 0; background: var(--fill-2); border-radius: 20px; transition: background .2s; cursor: pointer; }
.switch i::after { content:""; position:absolute; top:2px; left:2px; width:27px; height:27px; border-radius:50%; background:#fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.25); transition: left .2s; }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { left: 22px; }
.switch-row { display:flex; align-items:center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--stroke); }
.switch-row:last-child { border-bottom: 0; }
.switch-row .t b { display:block; font-size: 15px; font-weight: 600; }
.switch-row .t span { font-size: 12.5px; color: var(--text-2); }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--stroke);
  cursor: pointer; transition: background .15s; border-radius: 10px;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--fill); padding-left: 10px; padding-right: 10px; margin: 0 -6px; }
.row .rmain { flex: 1; min-width: 0; }
.row .rtitle { font-weight: 600; font-size: 15.5px; display:flex; align-items:center; gap:8px; flex-wrap: wrap; }
.row .rsub { font-size: 13px; color: var(--text-2); margin-top: 2px; display:flex; gap: 8px; flex-wrap: wrap; align-items: center;}
.row .rend { text-align: right; flex-shrink: 0; }
.chev { color: var(--text-3); flex-shrink: 0; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px; letter-spacing: .01em; white-space: nowrap; }
.badge.code { background: var(--fill); color: var(--text-2); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px; }
.badge.open { background: rgba(255,159,10,.15); color: #c77800; }
.badge.in_progress { background: rgba(10,132,255,.14); color: var(--accent); }
.badge.done { background: rgba(48,209,88,.16); color: #1e9e46; }
.badge.verified { background: rgba(94,92,230,.15); color: #5e5ce6; }
.badge.cancelled { background: var(--fill); color: var(--text-2); }
.badge.Urgent { background: rgba(255,69,58,.14); color: var(--red); }
.badge.High { background: rgba(255,159,10,.15); color: #c77800; }
.badge.overdue { background: rgba(255,69,58,.14); color: var(--red); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge.open { color: #ffb340; }
  :root:not([data-theme="light"]) .badge.done { color: #4cd964; }
  :root:not([data-theme="light"]) .badge.verified { color: #7d7aff; }
  :root:not([data-theme="light"]) .badge.High { color: #ffb340; }
}
[data-theme="dark"] .badge.open { color: #ffb340; }
[data-theme="dark"] .badge.done { color: #4cd964; }
[data-theme="dark"] .badge.verified { color: #7d7aff; }
[data-theme="dark"] .badge.High { color: #ffb340; }

/* ---------- progress ---------- */
.progress { height: 8px; border-radius: 6px; background: var(--fill-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, #0a84ff, #5e5ce6); transition: width .4s cubic-bezier(.2,.8,.2,1); }
.progress.green > i { background: linear-gradient(90deg, #30d158, #26a544); }
.progress-line { display: flex; align-items: center; gap: 10px; }
.progress-line .progress { flex: 1; }
.progress-line b { font-size: 12.5px; color: var(--text-2); min-width: 34px; text-align: right; }

/* service ring */
.ring-wrap { display: flex; align-items: center; gap: 14px; }
.ring { transform: rotate(-90deg); }
.ring .track { stroke: var(--fill-2); }
.ring .bar { transition: stroke-dashoffset .5s; stroke-linecap: round; }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-label b { font-size: 15px; font-weight: 800; letter-spacing: -.02em; }
.ring-label span { font-size: 9.5px; color: var(--text-2); font-weight: 600; text-transform: uppercase; }
.ring-box { position: relative; width: 74px; height: 74px; flex: 0 0 74px; }

/* ---------- photos ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 10px; }
.photo-grid a, .photo-grid .ph { display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--fill); position: relative; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-grid .pdf { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px;
  font-size: 11px; font-weight: 700; color: var(--red); height: 100%; text-align: center; padding: 6px; }
.photo-add {
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px;
  aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed var(--stroke); color: var(--text-2);
  cursor: pointer; font-size: 12px; font-weight: 600; background: transparent;
}
.photo-add svg { width: 22px; height: 22px; }
.photo-remove { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; border: 0; font-size: 13px; cursor: pointer; display:flex; align-items:center; justify-content:center; }

/* ---------- modal (iOS sheet) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .2s; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg); width: 100%; max-width: 640px; max-height: 92dvh; overflow-y: auto;
  border-radius: 22px 22px 0 0; padding: 10px 20px calc(24px + var(--safe-b));
  animation: sheetUp .3s cubic-bezier(.2,.9,.3,1);
}
@media (min-width: 700px) {
  .modal-backdrop { align-items: center; padding: 30px; }
  .modal { border-radius: 22px; padding-bottom: 24px; max-height: 86dvh; }
}
.modal .grab { width: 38px; height: 5px; border-radius: 3px; background: var(--fill-2); margin: 6px auto 12px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h2 { font-size: 20px; font-weight: 700; }
.modal-close { border: 0; background: var(--fill); width: 32px; height: 32px; border-radius: 50%;
  font-size: 16px; cursor: pointer; color: var(--text-2); display:flex; align-items:center; justify-content:center; }
@keyframes sheetUp { from { transform: translateY(60px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + var(--safe-b)); z-index: 200;
  background: var(--card-solid); color: var(--text); border: 1px solid var(--stroke);
  padding: 12px 20px; border-radius: 16px; box-shadow: var(--shadow); font-weight: 600; font-size: 14.5px;
  animation: toastIn .25s cubic-bezier(.2,.9,.3,1); max-width: min(90vw, 420px); text-align: center;
}
.toast.error { color: var(--red); }
@keyframes toastIn { from { transform: translate(-50%, 16px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@media (min-width: 900px) { .toast { bottom: 34px; } }

/* ---------- login ---------- */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; width: 100%; }
.login-card { width: 100%; max-width: 380px; padding: 34px 28px; text-align: center; }
.login-card .brand-mark { width: 64px; height: 64px; border-radius: 16px; font-size: 24px; margin: 0 auto 16px; }
.login-card h1 { font-size: 24px; font-weight: 800; }
.login-card .sub { color: var(--text-2); font-size: 14px; margin: 4px 0 22px; }

/* ---------- misc ---------- */
.empty { text-align: center; color: var(--text-2); padding: 34px 16px; font-size: 14.5px; }
.empty svg { width: 40px; height: 40px; color: var(--text-3); margin-bottom: 8px; }
.divider { height: 1px; background: var(--stroke); margin: 16px 0; }
.meta-line { font-size: 13px; color: var(--text-2); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item { display: flex; gap: 12px; padding: 10px 0; }
.tl-item .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: 0 0 9px; }
.tl-item.system .dot { background: var(--text-3); }
.tl-item .body { flex: 1; min-width: 0; }
.tl-item .who { font-size: 13px; font-weight: 700; }
.tl-item .when { font-size: 11.5px; color: var(--text-3); font-weight: 500; margin-left: 6px; }
.tl-item p { margin: 3px 0 0; font-size: 14.5px; white-space: pre-wrap; }
.tl-item.system p { color: var(--text-2); font-size: 13.5px; font-style: italic; }

.milestone { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--stroke); }
.milestone:last-child { border-bottom: 0; }
.check {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--fill-2); background: transparent;
  cursor: pointer; flex: 0 0 26px; display: flex; align-items: center; justify-content: center; color: #fff;
  transition: all .15s; padding: 0;
}
.check.done { background: var(--green); border-color: var(--green); }
.check svg { width: 14px; height: 14px; }
.milestone .mt { flex: 1; font-size: 15px; }
.milestone .mt.done { color: var(--text-2); text-decoration: line-through; }
.milestone .mby { font-size: 11.5px; color: var(--text-3); }

.avatar-sm { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg,#64d2ff,#0a84ff);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.avatars { display: inline-flex; }
.avatars .avatar-sm { margin-left: -6px; border: 2px solid var(--card-solid); }
.avatars .avatar-sm:first-child { margin-left: 0; }

.searchbar { position: relative; margin-bottom: 14px; }
.searchbar input { padding-left: 38px; }
.searchbar svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-3); }

.pill-select { display: flex; gap: 8px; flex-wrap: wrap; }
.pill-select .pill {
  border: 1.5px solid var(--stroke); background: transparent; color: var(--text); border-radius: 20px;
  padding: 7px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; display: inline-flex; gap: 6px; align-items: center;
}
.pill-select .pill.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.gps-box { display: flex; gap: 10px; align-items: center; }
.gps-box .status { font-size: 13px; color: var(--text-2); flex: 1; }
.gps-box .status.ok { color: #1e9e46; font-weight: 600; }

.section-label { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 22px 0 8px 4px; }
.workload-person { padding: 14px 0; border-bottom: 1px solid var(--stroke); }
.workload-person:last-child { border-bottom: 0; }
.skel { animation: pulse 1.4s ease-in-out infinite; background: var(--fill); border-radius: 12px; }
@keyframes pulse { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
img.lightboxable { cursor: zoom-in; }

/* ---------- notifications ---------- */
.bell-wrap { position: relative; }
.nbadge { position: absolute; top: 4px; right: 6px; min-width: 17px; height: 17px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 10.5px; font-weight: 800; display: flex; align-items: center;
  justify-content: center; padding: 0 4px; border: 2px solid var(--card-solid); }
.tab .nbadge { top: 0; right: calc(50% - 20px); }
.notif { display: flex; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--stroke); cursor: pointer; }
.notif:last-child { border-bottom: 0; }
.notif .ndot { width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; flex: 0 0 9px; background: var(--accent); }
.notif.read .ndot { background: var(--fill-2); }
.notif p { margin: 0; font-size: 14.5px; }
.notif .nwhen { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.notif.svc .ndot { background: var(--orange); }
.notif.svc.overdue .ndot { background: var(--red); }

/* contractor chips on due services */
.ctr-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--fill); border-radius: 12px;
  padding: 7px 12px; font-size: 13px; font-weight: 600; margin: 4px 6px 0 0; }
.ctr-chip a { display: inline-flex; }

/* ---------- field app (maintenance on iPhone/iPad) ---------- */
.field-card { padding: 16px; margin-bottom: 14px; cursor: pointer; }
.field-card .fc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.field-card h3 { font-size: 17px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.field-card .fc-where { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13.5px; margin-top: 5px; }
.field-card .fc-actions { display: flex; gap: 8px; margin-top: 12px; }
.field-due { font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 16px; background: var(--fill); color: var(--text-2); white-space: nowrap; }
.field-due.today { background: rgba(255,159,10,.15); color: #c77800; }
.field-due.late { background: rgba(255,69,58,.14); color: var(--red); }

/* ---------- chat ---------- */
.home-switch { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.home-switch::-webkit-scrollbar { display: none; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 6px 2px 12px; }
.chat-day { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--text-3); margin: 14px 0 8px; text-transform: uppercase; letter-spacing: .05em; }
.bubble-row { display: flex; margin: 3px 0; }
.bubble-row.mine { justify-content: flex-end; }
.bubble {
  max-width: min(78%, 480px); padding: 9px 14px; border-radius: 18px 18px 18px 5px;
  background: var(--fill); font-size: 15px; white-space: pre-wrap; word-break: break-word;
}
.bubble.mine { background: var(--accent); color: #fff; border-radius: 18px 18px 5px 18px; }
.bubble-time { font-size: 10.5px; opacity: .65; margin-top: 3px; text-align: right; }
.chat-composer { display: flex; gap: 8px; align-items: flex-end; padding-top: 10px; border-top: 1px solid var(--stroke); }
.chat-composer .input { flex: 1; }

/* blocked-platform screen */
.blocked { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.blocked .card { max-width: 420px; text-align: center; padding: 36px 28px; }
.blocked h2 { margin-bottom: 8px; }
.blocked p { color: var(--text-2); margin: 0 0 20px; }

/* ---------- reports / charts ---------- */
.rpt-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.rpt-filters .field { margin: 0; min-width: 150px; flex: 1; }
.chart-wrap { overflow-x: auto; }
.chart-legend { display: flex; gap: 16px; margin: 4px 0 10px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 52px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13.5px; }
.hbar-row .lbl { color: var(--text-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 14px; border-radius: 0 4px 4px 0; background: var(--fill); position: relative; }
.hbar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0; background: var(--chart-1); min-width: 2px; }
.hbar-row .val { font-weight: 700; font-size: 12.5px; text-align: left; color: var(--text-2); }
.insight { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; font-size: 14.5px; border-bottom: 1px solid var(--stroke); }
.insight:last-child { border-bottom: 0; }
.insight-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: 0 0 9px; background: var(--accent); }
.insight.warn .insight-dot { background: var(--orange); }
.insight.alert .insight-dot { background: var(--red); }
.stackbar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--fill); gap: 2px; }
.stackbar i { display: block; height: 100%; min-width: 4px; }
.stackbar-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.stackbar-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.card.stat { border-top: 3px solid transparent; }
.rpt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rpt-table th { text-align: left; padding: 8px 10px; color: var(--text-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--stroke); position: sticky; top: 0; background: var(--card-solid); }
.rpt-table td { padding: 9px 10px; border-bottom: 1px solid var(--stroke); }
.rpt-table tr:hover td { background: var(--fill); }
.rpt-scroll { max-height: 480px; overflow: auto; border-radius: 12px; border: 1px solid var(--stroke); }
@media print {
  .sidebar, .tabbar, .head-actions, .rpt-filters, .no-print { display: none !important; }
  .main { padding: 0; }
  body::before { display: none; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
.lightbox { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; cursor: zoom-out; animation: fadeIn .2s; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 8px; }
