/* عود — الموارد البشرية: admin portal. Builds on /tokens.css (colours, font, light/dark). */
:root {
  --side-w: 256px;
  --top-h: 64px;
  --gutter: 28px;
  --ring: var(--focus);
  --row-hover: color-mix(in srgb, var(--accent-soft) 55%, transparent);
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (max-width: 899px) { :root { --gutter: 16px; --top-h: 56px; } }

body { min-height: 100vh; overflow-x: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; letter-spacing: -.005em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: 13px; }
.mono, [dir=ltr].mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: .02em; }
.nowrap { white-space: nowrap; }
.right { text-align: start; }
.hide { display: none !important; }
.lead { font-size: 16px; color: var(--ink); }
.num, .money, td.n { font-variant-numeric: tabular-nums lining-nums; }
.money small { color: var(--muted); font-size: .72em; font-weight: 500; }
.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { opacity: .9; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ——— Shell ——— */
.shell { min-height: 100vh; }
.side { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--side-w); background: var(--surface); border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 30; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 22px 22px 18px; border-bottom: 1px solid var(--line); text-decoration: none !important; }
.side-brand img { width: 74px; height: auto; display: block; }
.side-brand div { display: flex; flex-direction: column; line-height: 1.25; }
.side-brand b { color: var(--ink); font-size: 15px; font-weight: 800; }
.side-brand span { color: var(--muted); font-size: 12px; }
.nav { flex: 1; overflow-y: auto; padding: 12px 12px 20px; scrollbar-width: thin; }
.nav-group { margin-top: 14px; }
.nav-group > span { display: block; padding: 0 12px 6px; font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 500; text-decoration: none; position: relative;
  transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.nav a.on::before { content: ''; position: absolute; inset-inline-start: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav a .badge { margin-inline-start: auto; }
.side-foot { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.side-foot .who { flex: 1; min-width: 0; line-height: 1.3; }
.side-foot .who b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: 12px; color: var(--muted); }

.main { margin-inline-start: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.topbar h1 { font-size: 17px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumb { color: var(--muted); font-weight: 500; }
.topbar .mobile-brand { display: none; }
.view { flex: 1; padding: 26px var(--gutter) 64px; width: 100%; max-width: 1360px; margin-inline: auto; }
.bottom-nav { display: none; }

@media (max-width: 899px) {
  .side { display: none; }
  .main { margin-inline-start: 0; }
  .topbar .mobile-brand { display: block; width: 46px; }
  .topbar h1 { font-size: 16px; }
  .view { padding: 18px var(--gutter) calc(96px + env(safe-area-inset-bottom)); }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 25;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; min-height: 52px; border: 0; background: none;
    color: var(--muted); font-size: 11.5px; font-weight: 600; text-decoration: none; border-radius: 12px; position: relative; cursor: pointer; }
  .bottom-nav .i { width: 23px; height: 23px; }
  .bottom-nav .on { color: var(--accent); }
  .bottom-nav .on .i { stroke-width: 2.2; }
  .bottom-nav .badge { position: absolute; top: 2px; inset-inline-end: 22%; }
}

/* Drawer (mobile «المزيد») */
.drawer { position: fixed; inset: 0; z-index: 60; background: rgba(20, 14, 9, .38); display: flex; align-items: flex-end; animation: fade .15s; }
.drawer-panel { background: var(--surface); width: 100%; max-height: 86vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 10px 14px calc(18px + env(safe-area-inset-bottom));
  animation: up .22s var(--ease); }
.drawer-panel .grip { width: 44px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 4px auto 10px; }
.drawer .nav { padding: 0; }
.drawer .nav-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.drawer .nav-grid a { flex-direction: column; text-align: center; gap: 6px; padding: 14px 6px; font-size: 13px; background: var(--surface-2); border-radius: 14px; }
.drawer .nav-grid a.on::before { display: none; }
.drawer .nav-grid .i { width: 24px; height: 24px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

/* ——— Buttons ——— */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s; position: relative; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn .i { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 0 rgba(255,255,255,.15) inset, 0 2px 8px color-mix(in srgb, var(--accent) 28%, transparent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-ghost { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) var(--muted);
  animation: spin .7s linear infinite; }
.btn.primary.loading::after, .btn.danger.loading::after, .btn.ok.loading::after { border-color: #fff transparent #fff #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; position: relative; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn .badge { position: absolute; top: 4px; inset-inline-end: 4px; }
.badge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
.tab .badge { background: var(--accent); margin-inline-start: 6px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ——— Page ——— */
.page { display: flex; flex-direction: column; gap: 20px; animation: in .25s var(--ease); }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.page-head p { margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title h3 { font-size: 16px; font-weight: 700; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.back .i { width: 16px; height: 16px; transform: scaleX(-1); }
@media (max-width: 899px) { .page-head h2 { font-size: 22px; } .page-head .actions { width: 100%; } .page-head .actions .btn { flex: 1; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 0 rgba(43, 33, 24, .02); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .section-title { padding: 16px 20px 0; }
.card.soft { background: var(--surface-2); border-color: transparent; }
.card.accent { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); }
.card h3 { font-size: 16px; font-weight: 700; }
a.card { color: inherit; text-decoration: none !important; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .cards-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .cards-2, .cards-3 { grid-template-columns: 1fr; } .grid { gap: 12px; } .card { padding: 16px; } }
@media (max-width: 420px) { .cards-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Stats */
.stat { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  color: inherit; text-decoration: none !important; min-width: 0; transition: border-color .15s, box-shadow .15s; }
a.stat:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 30px; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12.5px; color: var(--muted); }
.stat.ok .stat-value { color: var(--ok); } .stat.warn .stat-value { color: var(--warn); } .stat.bad .stat-value { color: var(--bad); } .stat.info .stat-value { color: var(--info); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stat-value { font-size: 25px; } }

/* Pills, chips, avatars */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; line-height: 1.6;
  background: var(--surface-2); color: var(--ink-2); }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); } .pill.info { background: var(--info-soft); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--surface) 70%, transparent); }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; object-fit: cover;
  background: linear-gradient(140deg, var(--accent-soft), color-mix(in srgb, var(--brass) 35%, var(--surface-2))); color: var(--accent); font-weight: 800; font-size: 14px; }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; }
.person b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.person:hover { text-decoration: none; } a.person:hover b { color: var(--accent); }

/* ——— Forms ——— */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2, .form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid, .form-grid.three { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { color: var(--muted); font-size: 12px; }
input[type=text], input[type=search], input[type=tel], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=time],
input:not([type]), select, textarea {
  width: 100%; min-height: 42px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: border-color .15s, box-shadow .15s; font-size: 15px; }
textarea { min-height: 90px; resize: vertical; line-height: 1.7; }
select { appearance: none; -webkit-appearance: none; padding-inline-end: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238c7f72' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 16px; background-position: left 10px center; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brass); box-shadow: var(--ring); }
input[type=date], input[type=month], input[type=time], input[dir=ltr], .ltr { direction: ltr; text-align: right; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; min-height: 34px; }
.check input { width: 19px; height: 19px; accent-color: var(--accent); flex: none; }
.input-icon { position: relative; }
.input-icon .i { position: absolute; top: 50%; inset-inline-start: 12px; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.input-icon input { padding-inline-start: 38px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0; min-width: 0; }
fieldset > legend { padding: 0 8px; font-weight: 700; font-size: 14px; color: var(--ink); }
.form-section { display: flex; flex-direction: column; gap: 14px; }
.form-section + .form-section { border-top: 1px solid var(--line); padding-top: 18px; }
.form-section > h4 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters > * { flex: 0 1 auto; }
.filters input[type=search] { min-width: 220px; flex: 1 1 240px; }
.filters select { width: auto; min-width: 150px; }
@media (max-width: 640px) { .filters > * { flex: 1 1 calc(50% - 10px); min-width: 0 !important; } .filters .input-icon { flex-basis: 100%; } }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 11px; flex-wrap: wrap; }
.seg button, .seg label { border: 0; background: transparent; padding: 7px 13px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); cursor: pointer; min-height: 36px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg .on, .seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg label { padding: 0; } .seg label span { padding: 7px 13px; border-radius: 8px; display: block; min-width: 40px; text-align: center; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--info-soft); color: var(--ink); font-size: 14px; align-items: flex-start; }
.callout .i { color: var(--info); margin-top: 2px; }
.callout.warn { background: var(--warn-soft); } .callout.warn .i { color: var(--warn); }
.callout.bad { background: var(--bad-soft); } .callout.bad .i { color: var(--bad); }
.callout.ok { background: var(--ok-soft); } .callout.ok .i { color: var(--ok); }
.callout ul { margin: 4px 0 0; padding-inline-start: 18px; }

/* ——— Tables ——— */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.t th { text-align: start; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 11px 14px; background: var(--surface-2); white-space: nowrap; border-bottom: 1px solid var(--line); }
.t th:first-child { border-start-start-radius: 0; }
.t td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tbody tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background .12s; }
.t tbody tr.clickable { cursor: pointer; }
.t tbody tr:hover { background: var(--row-hover); }
.t td.n, .t th.n { text-align: end; white-space: nowrap; }
.t tfoot td { font-weight: 800; background: var(--surface-2); border-top: 1px solid var(--line-strong); }
.t .sub-row td { background: var(--surface-2); padding: 0; }
.card.flush .t th:first-child, .card.flush .t td:first-child { padding-inline-start: 20px; }
.card.flush .t th:last-child, .card.flush .t td:last-child { padding-inline-end: 20px; }
/* Responsive table → cards */
@media (max-width: 760px) {
  table.rt, .rt tbody, .rt tr, .rt td { display: block; width: 100%; }
  .rt thead { display: none; }
  .rt tbody tr { padding: 12px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .rt td { padding: 0; border: 0; font-size: 13.5px; min-width: 0; }
  .rt td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
  .rt td.primary { grid-column: 1 / -1; font-size: 15px; }
  .rt td.n { text-align: start; }
  .rt td.act { grid-column: 1 / -1; }
  .rt td:empty { display: none; }
  .card.flush .rt td:first-child, .card.flush .rt td:last-child { padding-inline: 0; }
}

/* Lists */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; color: inherit; text-decoration: none !important; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow b { display: block; font-weight: 600; }
.list-item .grow span { display: block; font-size: 13px; color: var(--muted); }
a.list-item:hover .grow b { color: var(--accent); }
.card.flush .list-item { padding-inline: 20px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 24px; margin: 0; }
.kv div { min-width: 0; }
.kv dt { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 0; background: none; padding: 11px 14px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-size: 14.5px; display: inline-flex; align-items: center; transition: color .15s; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }

/* Empty, skeleton */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 44px 20px; color: var(--muted); }
.empty .i { width: 40px; height: 40px; stroke-width: 1.3; color: var(--brass); margin-bottom: 4px; }
.empty b { color: var(--ink); font-size: 16px; }
.empty p { max-width: 420px; font-size: 14px; }
.empty .btn { margin-top: 8px; }
.empty.bad .i { color: var(--bad); }
.sk-wrap { display: flex; flex-direction: column; gap: 12px; }
.sk { height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 50%, var(--surface-2) 75%);
  background-size: 300% 100%; animation: shimmer 1.3s infinite linear; }
.sk-big { height: 34px; width: 50%; } .sk-title { height: 30px; width: 260px; max-width: 70%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Toasts */
#toasts { position: fixed; inset-inline: 0; bottom: 24px; z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
@media (max-width: 899px) { #toasts { bottom: calc(84px + env(safe-area-inset-bottom)); } }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow);
  font-weight: 600; font-size: 14px; max-width: 520px; animation: up .25s var(--ease); pointer-events: auto; }
.toast.bad { background: var(--bad); color: #fff; }
.toast .i { width: 18px; height: 18px; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .4s; }

/* Dialogs */
dialog.modal { border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--surface); color: var(--ink);
  box-shadow: 0 24px 80px rgba(0,0,0,.28); display: flex; flex-direction: column; overflow: hidden; }
dialog.modal:not([open]) { display: none; }
dialog.modal.wide { width: min(900px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(23, 16, 10, .45); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: pop .2s var(--ease); }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 18px; font-weight: 800; }
.modal-head p { font-size: 13.5px; margin-top: 2px; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-body > form > .modal-foot, .modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.modal-body > form > .modal-foot { margin: 6px -20px -18px; position: sticky; bottom: -18px; }
@media (max-width: 640px) {
  dialog.modal, dialog.modal.wide { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  dialog.modal[open] { animation: up .25s var(--ease); }
  .modal-foot .btn, .modal-body > form > .modal-foot .btn { flex: 1; min-height: 46px; }
  .modal-body > form > .modal-foot, .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}
.cred { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.cred div { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.cred b { font-size: 20px; font-weight: 800; color: var(--accent); text-align: start; }

/* Popover menus (bell, account) */
.pop { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: 360px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 18px 50px rgba(0,0,0,.18); z-index: 50; overflow: hidden; animation: pop .15s var(--ease); }
.pop-anchor { position: relative; }
.pop-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
.pop-list { max-height: 420px; overflow-y: auto; }
.notif { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; color: inherit; text-decoration: none !important; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.notif .dot { margin-top: 8px; background: var(--accent); }
.notif:not(.unread) .dot { background: transparent; box-shadow: none; }
.notif b { display: block; font-size: 14px; } .notif p { font-size: 13px; color: var(--ink-2); } .notif small { color: var(--muted); font-size: 12px; }
.menu-list { padding: 6px; display: flex; flex-direction: column; }
.menu-list button, .menu-list a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 0; background: none; cursor: pointer; text-align: start;
  color: var(--ink); font-weight: 500; text-decoration: none !important; min-height: 42px; }
.menu-list button:hover, .menu-list a:hover { background: var(--surface-2); }
.menu-list .i { color: var(--muted); }
.menu-who { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
@media (max-width: 640px) { .pop { position: fixed; top: calc(var(--top-h) + 6px); inset-inline: 12px; width: auto; } }

/* ——— Sign-in ——— */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-art { position: relative; overflow: hidden; background: radial-gradient(120% 80% at 80% 10%, color-mix(in srgb, var(--accent) 22%, var(--surface-2)), var(--surface-2) 60%);
  display: flex; flex-direction: column; justify-content: space-between; padding: 48px; }
.auth-art::after { content: ''; position: absolute; inset: auto -10% -30% -10%; height: 70%; opacity: .5;
  background: repeating-radial-gradient(ellipse at 50% 120%, transparent 0 22px, color-mix(in srgb, var(--accent) 16%, transparent) 22px 23px); pointer-events: none; }
.auth-art img { width: 220px; position: relative; z-index: 1; }
.auth-art h2 { font-size: 34px; font-weight: 800; line-height: 1.35; max-width: 420px; position: relative; z-index: 1; }
.auth-art p { color: var(--ink-2); max-width: 400px; margin-top: 10px; position: relative; z-index: 1; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 18px; }
.auth-card h1 { font-size: 28px; font-weight: 800; }
.auth-card .btn { min-height: 48px; font-size: 15.5px; }
.auth-card input { min-height: 48px; }
.auth-mobile-logo { display: none; width: 150px; margin-bottom: 8px; }
@media (max-width: 899px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } .auth-mobile-logo { display: block; } .auth-form { align-items: start; padding-top: 12vh; } }

/* ——— Dashboard ——— */
.hello { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.hello h2 { font-size: 28px; font-weight: 800; }
.today-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.today-strip a { padding: 18px 20px; color: inherit; text-decoration: none !important; border-inline-start: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; transition: background .15s; }
.today-strip a:first-child { border-inline-start: 0; }
.today-strip a:hover { background: var(--surface-2); }
.today-strip b { font-size: 34px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.today-strip span { color: var(--muted); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
@media (max-width: 760px) { .today-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } .today-strip a:nth-child(4) { border-inline-start: 0; }
  .today-strip a:nth-child(n+4) { border-top: 1px solid var(--line); } .today-strip b { font-size: 26px; } .today-strip a { padding: 14px; } }
.bar { height: 8px; border-radius: 5px; background: var(--surface-2); overflow: hidden; position: relative; }
.bar > i { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 5px; background: var(--accent); }
.bar.ok > i { background: var(--ok); } .bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }
.tile-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mini-stat { display: flex; align-items: baseline; gap: 6px; } .mini-stat b { font-size: 22px; font-weight: 800; }

/* Profile */
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head .grow { flex: 1; min-width: 220px; }
.profile-head h2 { font-size: 26px; font-weight: 800; }
.profile-head .meta { display: flex; gap: 8px 14px; flex-wrap: wrap; color: var(--muted); font-size: 14px; margin-top: 4px; align-items: center; }
.photo-btn { position: relative; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; }
.photo-btn::after { content: '✎'; position: absolute; bottom: 0; inset-inline-end: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 12px; color: var(--ink-2); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 22px 18px 0; }
.timeline li::before { content: ''; position: absolute; inset-inline-start: 4px; top: 8px; bottom: -8px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ''; position: absolute; inset-inline-start: 0; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brass); }
.timeline li.ok::after { border-color: var(--ok); background: var(--ok); } .timeline li.bad::after { border-color: var(--bad); background: var(--bad); }
.timeline li { padding-inline-start: 22px; padding-inline-end: 0; }
.timeline b { font-weight: 700; } .timeline small { color: var(--muted); display: block; }
.checklist { display: flex; flex-direction: column; }
.checklist label { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; cursor: pointer; }
.checklist label:last-child { border-bottom: 0; }
.checklist input { width: 20px; height: 20px; accent-color: var(--ok); margin-top: 2px; flex: none; }
.checklist .done b { text-decoration: line-through; color: var(--muted); }
.checklist small { display: block; color: var(--muted); font-size: 12.5px; }
.progress-ring { --p: 0; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); position: relative; flex: none; }
.progress-ring::before { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.progress-ring span { position: relative; }

/* Schedule grid */
.sched-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); -webkit-overflow-scrolling: touch; }
table.sched { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 860px; table-layout: fixed; }
.sched th, .sched td { border-bottom: 1px solid var(--line); border-inline-start: 1px solid var(--line); padding: 6px; vertical-align: top; }
.sched th { background: var(--surface-2); font-size: 12.5px; font-weight: 700; color: var(--ink-2); padding: 10px 6px; text-align: center; }
.sched th small { display: block; font-weight: 500; color: var(--muted); }
.sched th.today { color: var(--accent); background: var(--accent-soft); }
.sched th.holiday, .sched td.holiday { background: color-mix(in srgb, var(--info-soft) 70%, var(--surface)); }
.sched .who { position: sticky; inset-inline-start: 0; z-index: 2; background: var(--surface); width: 190px; border-inline-start: 0; text-align: start; }
.sched th.who { background: var(--surface-2); z-index: 3; }
.sched .who b { font-size: 13.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched .who span { font-size: 12px; color: var(--muted); display: block; }
.sched tr:last-child td { border-bottom: 0; }
.cell { width: 100%; min-height: 54px; border-radius: 9px; border: 1px dashed var(--line-strong); background: transparent; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px; font-size: 12.5px; color: var(--muted); padding: 4px; transition: border-color .15s, background .15s; position: relative; }
.cell:hover { border-color: var(--brass); background: var(--surface-2); }
.cell.shift { border: 0; background: color-mix(in srgb, var(--c) 18%, var(--surface)); color: var(--ink); border-inline-start: 4px solid var(--c); }
.cell.shift b { font-size: 12.5px; font-weight: 700; } .cell.shift span { font-size: 12px; direction: ltr; color: var(--ink-2); }
.cell.off { border-style: solid; border-color: var(--line); background: var(--surface-2); color: var(--muted); font-weight: 600; }
.cell.leave { border: 0; background: var(--info-soft); color: var(--info); font-weight: 700; }
.cell.unpub::after { content: ''; position: absolute; top: 5px; inset-inline-end: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.tpl-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tpl-pick button { border: 1px solid var(--line); border-inline-start: 5px solid var(--c); border-radius: 10px; padding: 10px; background: var(--surface); text-align: start; cursor: pointer;
  display: flex; flex-direction: column; min-height: 58px; }
.tpl-pick button:hover, .tpl-pick button.on { background: color-mix(in srgb, var(--c) 14%, var(--surface)); }
.tpl-pick button span { font-size: 12.5px; color: var(--muted); direction: ltr; text-align: end; }
.week-nav { display: flex; align-items: center; gap: 6px; }
.week-nav b { min-width: 170px; text-align: center; }

/* Media */
.thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--surface-2); cursor: zoom-in; border: 1px solid var(--line); display: block; }
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.82); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 12px; }
.file-drop { border: 1.5px dashed var(--line-strong); border-radius: 12px; padding: 14px; display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--ink-2); }
.file-drop:hover { border-color: var(--brass); background: var(--surface-2); }
.file-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.kcol { background: var(--surface-2); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 160px; }
.kcol h4 { font-size: 13.5px; font-weight: 700; display: flex; justify-content: space-between; padding: 4px 6px; color: var(--ink-2); }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; color: inherit; text-decoration: none !important; display: flex; flex-direction: column; gap: 4px; }
.kcard:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.kcard b { font-weight: 700; } .kcard span { font-size: 12.5px; color: var(--muted); }
.stars { color: var(--brass); letter-spacing: 1px; }
@media (max-width: 760px) { .kanban { grid-auto-flow: row; grid-auto-columns: auto; } .kcol { min-height: 0; } }

/* Markdown */
.md { line-height: 1.95; font-size: 15.5px; max-width: 820px; overflow-wrap: anywhere; }
.md h1 { font-size: 26px; font-weight: 800; margin: 8px 0 14px; } .md h2 { font-size: 21px; font-weight: 800; margin: 28px 0 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.md h3 { font-size: 17px; font-weight: 700; margin: 20px 0 6px; } .md h4 { font-size: 15.5px; font-weight: 700; margin: 16px 0 4px; }
.md p { margin: 0 0 12px; } .md ul, .md ol { margin: 0 0 12px; padding-inline-start: 24px; } .md li { margin: 3px 0; }
.md blockquote { margin: 0 0 12px; padding: 8px 16px; border-inline-start: 3px solid var(--brass); background: var(--surface-2); border-radius: 0 10px 10px 0; color: var(--ink-2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.md code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; font-size: .92em; }
.md .tbl { overflow-x: auto; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 12px; }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 1.7; }
.md th, .md td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.md th { background: var(--surface-2); font-weight: 700; }
.md tr:last-child td { border-bottom: 0; }
.md .ph { background: var(--warn-soft); color: var(--warn); border-radius: 5px; padding: 0 5px; font-size: .9em; }

/* Survey bars */
.qbar { display: grid; grid-template-columns: minmax(0, 1fr) 200px 44px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.qbar:last-child { border-bottom: 0; }
.qbar b { text-align: end; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .qbar { grid-template-columns: 1fr 44px; } .qbar .bar { grid-column: 1 / -1; grid-row: 2; } }

/* Payroll */
.lines { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px 20px; }
.lines h5 { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.line { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.line:last-child { border-bottom: 0; }
@media (max-width: 760px) { .lines { grid-template-columns: 1fr; padding: 12px 0; } }
.split-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.split-bar i { display: block; height: 100%; }
.m-mudad { background: var(--info); } .m-bank { background: var(--accent); } .m-cash { background: var(--brass); }
.edit-rows { display: flex; flex-direction: column; gap: 8px; }
.edit-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: center; }
@media (max-width: 640px) { .edit-row { grid-template-columns: 1fr 1fr; } .edit-row > :first-child { grid-column: 1 / -1; } }

/* Stars input */
.rate { display: flex; gap: 4px; flex-wrap: wrap; }
.rate label { cursor: pointer; }
.rate input { position: absolute; opacity: 0; pointer-events: none; }
.rate span { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--surface-2); font-weight: 700; color: var(--ink-2); transition: .12s; }
.rate input:checked + span { background: var(--accent); color: var(--accent-ink); }
.rate input:focus-visible + span { box-shadow: var(--ring); }
.crit { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.score-big { font-size: 44px; font-weight: 900; line-height: 1; letter-spacing: -.02em; }

/* ——— Print pages (letters, payslips, settlements) ——— */
.paper-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.paper { background: #fff; color: #1f1812; width: 210mm; max-width: 100%; min-height: 297mm; margin: 0 auto; padding: 18mm 18mm 22mm; box-shadow: var(--shadow); border-radius: 6px;
  position: relative; font-size: 14.5px; line-height: 1.9; }
.paper .ph-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 14px; border-bottom: 2px solid var(--ec, #965f2f); }
.paper .ph-head img { width: 120px; }
.paper .ph-head .org b { font-size: 17px; display: block; } .paper .ph-head .org span { display: block; font-size: 12.5px; color: #6b5d50; }
.paper .ref { display: flex; justify-content: space-between; font-size: 12.5px; color: #6b5d50; margin: 14px 0 24px; }
.paper h2 { text-align: center; font-size: 22px; font-weight: 800; margin: 10px 0 22px; }
.paper p { margin: 0 0 12px; text-align: justify; }
.paper table { width: 100%; border-collapse: collapse; margin: 10px 0 16px; font-size: 13.5px; }
.paper th, .paper td { border: 1px solid #ddd2c3; padding: 6px 10px; text-align: start; }
.paper th { background: #f6f1e9; }
.paper .sign { display: flex; justify-content: space-between; gap: 24px; margin-top: 48px; }
.paper .sign div { flex: 1; text-align: center; }
.paper .sign .line-s { border-top: 1px solid #b9ab98; margin-top: 46px; padding-top: 4px; font-size: 12.5px; color: #6b5d50; }
.paper .foot { position: absolute; bottom: 10mm; inset-inline: 18mm; font-size: 11px; color: #8c7f72; display: flex; justify-content: space-between; border-top: 1px solid #eee4d6; padding-top: 6px; }
.paper .net { display: flex; justify-content: space-between; align-items: center; background: #f6f1e9; border-radius: 8px; padding: 10px 14px; font-weight: 800; font-size: 17px; }
.paper .mono-n { font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .paper { padding: 22px 18px 60px; min-height: 0; font-size: 13.5px; } .paper .foot { inset-inline: 18px; } }

/* Week navigator: full row on phones */
.week-nav { flex-wrap: wrap; min-width: 0; }
@media (max-width: 640px) {
  .filters > .week-nav { flex: 1 1 100%; justify-content: space-between; }
  .week-nav b { min-width: 0; flex: 1; font-size: 14px; }
  .filters > .btn-row { flex: 1 1 100%; }
  .filters > .btn-row .btn { flex: 1; }
}
.t td.primary { min-width: 170px; }
@media (max-width: 760px) { .t td.primary { min-width: 0; } }
.dot { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--ink) 18%, transparent); }
.avatar { letter-spacing: 0; text-transform: uppercase; overflow: hidden; }
