/* Ikaros Employee Portal */
:root {
  --ground: #F4F4F3; --card: #FFFFFF; --ink: #1F1F1F; --ink-2: #3F3F3F; --muted: #5F5F5F;
  --line: #E2E2E0; --line-2: #EDEDEB; --field: #CFCFCC; --charcoal: #2B2B2B;
  --warn-bg: #FBEEDC; --warn: #8A4B00; --info-bg: #E6EDF7; --info: #244E86;
  --err-bg: #FBE7E5; --err: #9B2C1F; --ok-bg: #E7F1EA; --ok: #24593A;
  --display: Jost, system-ui, sans-serif; --body: Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--charcoal); }
a:hover { color: #000; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; margin: 0; }
p { margin: 0; }
img { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.warn-text { color: var(--warn); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

/* ---------- Forms & buttons ---------- */
label, .label { font-size: 13px; font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 8px; }
input[type=text], input[type=email], input[type=date], input[type=time], input[type=file], input[type=number], input[type=tel], select, textarea {
  width: 100%; min-height: 48px; border: 1px solid var(--field); border-radius: 10px; padding: 0 14px;
  font: inherit; font-size: 16px; background: #fff; color: var(--ink);
}
textarea { padding: 12px 14px; resize: vertical; min-height: 90px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--charcoal); outline-offset: 2px; }
input::placeholder, textarea::placeholder { color: #8A8A8A; }
input[type=range] { width: 100%; accent-color: var(--charcoal); height: 28px; }
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--charcoal); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 10px;
  border: 1px solid var(--charcoal); background: var(--charcoal); color: #fff; font: inherit; font-size: 15px; font-weight: 500; text-decoration: none; cursor: pointer; }
.btn:hover { background: #000; color: #fff; }
.btn-block { width: 100%; }
.btn-big { min-height: 52px; font-size: 16px; border-radius: 12px; }
.btn-light { background: #fff; color: var(--ink); border-color: var(--field); }
.btn-light:hover { background: #F7F7F6; color: var(--ink); }
.btn-white { background: #fff; color: var(--ink); border-color: #fff; font-weight: 600; }
.btn-white:hover { background: #EDEDED; color: var(--ink); }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 8px; }
.btn[disabled], .btn.busy { opacity: .6; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 500; color: var(--charcoal); text-decoration: underline; cursor: pointer; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; font-size: 14px; font-weight: 400; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--field); background: #fff; font-size: 14px; font-weight: 400; cursor: pointer; }
.pill input:checked + span { background: var(--charcoal); border-color: var(--charcoal); color: #fff; }
.pill input:focus-visible + span { outline: 2px solid var(--charcoal); outline-offset: 2px; }
.pill-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pill-grid .pill span { width: 100%; min-height: 64px; border-radius: 12px; flex-direction: column; justify-content: center; gap: 2px; font-weight: 500; }
.pill-grid .pill small { font-weight: 400; opacity: .8; font-size: 12px; }

.flash { border-radius: 12px; padding: 12px 16px; font-size: 14px; background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--err-bg); color: var(--err); }
.flash-warn { background: var(--warn-bg); color: var(--warn); }
.form-error { border-radius: 12px; padding: 12px 16px; font-size: 14px; background: var(--err-bg); color: var(--err); }

.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #ECECEA; color: var(--charcoal); white-space: nowrap; }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-info { background: var(--info-bg); color: var(--info); }
.chip-outline { background: #fff; color: var(--muted); border: 1px solid var(--field); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; }
.card-list { background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.card-list > * { padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.card-list > *:last-child { border-bottom: 0; }
.list-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.empty { padding: 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Phone layouts ---------- */
.phone { max-width: 480px; margin: 0 auto; padding: 20px 20px 32px; display: flex; flex-direction: column; gap: 18px; min-height: 100vh; }
.phone.with-nav { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; gap: 4px; margin: -4px 0 -2px -10px; }
.topbar h1 { font-size: 22px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); border-radius: 22px; }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.bottom-nav a { height: 68px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: #6B6B6B; font-size: 12px; }
.bottom-nav a[aria-current] { color: var(--ink); font-weight: 600; }
@media (min-width: 520px) { .bottom-nav { max-width: 480px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 16px 16px 0 0; } }

.brand-block { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 40px; }
.brand-block img { height: 92px; width: auto; }
.wordmark { font-family: var(--display); font-size: 26px; font-weight: 500; letter-spacing: .32em; margin-right: -.32em; }
.wordmark-sub { font-family: var(--display); font-size: 11px; font-weight: 500; letter-spacing: .4em; margin-right: -.4em; color: var(--muted); margin-top: -10px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; display: flex; flex-direction: column; gap: 20px; margin-top: 24px; }
.login-card h1 { font-size: 24px; }
.foot-note { margin-top: auto; text-align: center; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.code-input { font-family: var(--display) !important; font-size: 28px !important; letter-spacing: .5em; text-align: center; padding-left: .5em !important; }
.info-box { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; font-size: 13px; color: var(--muted); }
.info-box svg { flex: none; margin-top: 1px; }

.hello { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hello img { height: 34px; width: auto; }
.hello h1 { font-size: 20px; }
.avatar { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line); background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; color: var(--charcoal); text-decoration: none; flex: none; }
.att-card { background: var(--charcoal); color: #fff; border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.att-card .eyebrow { font-size: 12px; letter-spacing: .08em; color: #C9C9C9; }
.att-card .big { font-family: var(--display); font-size: 22px; }
.att-card .meta { font-size: 13px; color: #E6E6E6; display: flex; align-items: center; gap: 8px; }
.att-card .hint { font-size: 12px; color: #C9C9C9; }
.att-card label { color: #E6E6E6; }
.att-card select { background: #fff; }
.sr-file { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; }
.att-card .selfie-btn { position: relative;  display: flex; align-items: center; gap: 10px; min-height: 48px; border: 1px dashed #8C8C8C; border-radius: 12px; padding: 8px 14px; color: #fff; cursor: pointer; font-size: 14px; font-weight: 400; }
.att-card .selfie-btn img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.att-card .form-error { background: #5A2A24; color: #FFE1DC; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--display); font-size: 24px; font-weight: 400; }
.stat span { font-size: 12px; color: var(--muted); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; }
.section-head h2 { font-size: 17px; }
.section-head a { font-size: 13px; font-weight: 500; }

.photo-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.photo-grid img, .photo-add { width: 100%; aspect-ratio: 1; border-radius: 10px; object-fit: cover; background: #D9D9D6; }
.photo-add { border: 1px dashed #9A9A97; background: #fff; display: flex; align-items: center; justify-content: center; color: var(--ink-2); cursor: pointer; }
.photo-add { position: relative; }
.photo-add input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; }

/* ---------- Admin ---------- */
.admin-shell { display: flex; flex-wrap: wrap; min-height: 100vh; align-items: stretch; }
.sidebar { flex: 1 1 220px; max-width: 100%; background: var(--charcoal); color: #fff; padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; text-decoration: none; color: #fff; }
.brand:hover { color: #fff; }
.brand span { display: flex; flex-direction: column; gap: 2px; }
.brand b { font-family: var(--display); font-weight: 500; font-size: 18px; letter-spacing: .24em; }
.brand small { font-family: var(--display); font-size: 10px; letter-spacing: .32em; color: #C9C9C9; }
.sidebar nav, .side-foot { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a, .side-foot a, .side-foot button { min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border-radius: 10px; color: #E0E0E0; text-decoration: none; font: inherit; font-size: 14px; background: none; border: 0; cursor: pointer; width: 100%; text-align: left; }
.sidebar nav a:hover, .side-foot a:hover, .side-foot button:hover { background: #363636; color: #fff; }
.sidebar nav a[aria-current] { background: #404040; color: #fff; font-weight: 500; }
.nav-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #A8A8A8; padding: 0 12px 4px; }
.sidebar { gap: 20px; }
.sidebar nav em { margin-left: auto; font-style: normal; font-size: 12px; background: #fff; color: var(--ink); border-radius: 999px; padding: 1px 8px; font-weight: 600; }
.side-foot { margin-top: auto; }
.admin-main { flex: 999 1 560px; min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 48px; }
.admin-inner { max-width: 1160px; display: flex; flex-direction: column; gap: 24px; }
@media (max-width: 800px) {
  .sidebar { padding: 12px; gap: 10px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar nav a { width: auto; }
  .side-foot { flex-direction: row; flex-wrap: wrap; }
  .side-foot a, .side-foot button { width: auto; }
}
.page-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; }
.page-head h1 { font-size: 30px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi b { font-family: var(--display); font-weight: 400; font-size: 32px; }
.kpi b small { font-size: 18px; color: #6B6B6B; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.col-main { flex: 999 1 520px; min-width: 0; }
.col-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel.flush { padding: 20px 0 8px; }
.panel.flush > .between, .panel.flush > .pad { padding: 0 20px; }
.panel h2 { font-size: 19px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; color: var(--muted); font-size: 12px; letter-spacing: .04em; font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
table.data td { padding: 12px; border-bottom: 1px solid #F0F0EE; vertical-align: middle; }
table.data th:first-child, table.data td:first-child { padding-left: 20px; }
table.data th:last-child, table.data td:last-child { padding-right: 20px; }
table.data tr:last-child td { border-bottom: 0; }
.who { display: flex; flex-direction: column; gap: 2px; }
.who b { font-weight: 500; }
.who span { font-size: 12px; color: var(--muted); }
.thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; display: block; }
.req { border: 1px solid var(--line-2); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.two-btn { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.feed-item { display: flex; flex-direction: column; gap: 4px; padding-bottom: 12px; border-bottom: 1px solid var(--line-2); }
.feed-item:last-child { border-bottom: 0; padding-bottom: 0; }
.site-card { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 16px 18px; text-decoration: none; color: var(--ink); }
.site-card:hover { border-color: #9A9A97; color: var(--ink); }
.site-card[aria-current] { background: var(--charcoal); border-color: var(--charcoal); color: #fff; }
.site-card .name { font-family: var(--display); font-size: 18px; font-weight: 500; }
.bar { height: 6px; border-radius: 3px; background: #E6E6E4; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--charcoal); border-radius: 3px; }
.site-card[aria-current] .bar { background: #555; }
.site-card[aria-current] .bar i { background: #fff; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.fact { background: var(--ground); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.fact span { font-size: 12px; color: var(--muted); }
.fact b { font-size: 15px; font-weight: 500; }
.log-item { display: flex; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line-2); }
.log-item .when { flex: none; width: 80px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; font-weight: 500; }
.log-item .when span { font-size: 12px; color: var(--muted); font-weight: 400; }
.log-item .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.log-photos { display: flex; flex-wrap: wrap; gap: 8px; }
.log-photos img { width: 96px; height: 72px; border-radius: 8px; object-fit: cover; background: #D9D9D6; }
.issue { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: 14px; display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.check-list label { display: flex; align-items: center; gap: 10px; font-weight: 400; font-size: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
details.panel summary { cursor: pointer; font-family: var(--display); font-size: 17px; }
.inline-form { display: inline; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .field { min-width: 160px; }

@media print {
  .sidebar, .no-print, .bottom-nav { display: none !important; }
  .admin-main { padding: 0; }
  body { background: #fff; }
  .panel, .card { border: 0; }
}

/* ---------- CRM ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); font-size: 13px; }
.tabs a[aria-current] { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }
.tabs a b { font-weight: 600; margin-left: 6px; }
.search { min-width: 220px; flex: 1; max-width: 360px; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.timeline-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.timeline-item .meta { font-size: 12px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px 4px; font-size: 13px; color: var(--muted); }
table.data tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; } }

/* ---------- Approval pop-up ---------- */
.toast { position: fixed; z-index: 50; right: 16px; top: 16px; width: min(380px, calc(100vw - 32px)); background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--charcoal);
  border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.14); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.toast-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line-2); padding-top: 10px; }
@media (max-width: 520px) { .toast { top: auto; bottom: calc(80px + env(safe-area-inset-bottom)); right: 12px; left: 12px; width: auto; } }
.status-chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.vendor-cat { font-size: 12px; color: var(--muted); }
