/* =============================================================================
   ATL Platform design system — token-driven; white-label tenants restyle via
   --brand-primary/--brand-accent injected per request by _Layout.
   Logical properties throughout (inline-start/end) so dir="rtl" mirrors
   correctly — §2c multi-language.
   ========================================================================== */

:root {
    --brand-primary: #1D9488;
    --brand-accent: #C9C9C9;
    --brand-dark: color-mix(in srgb, var(--brand-primary) 78%, black);
    --brand-tint: color-mix(in srgb, var(--brand-primary) 10%, white);
    --ink: #22312F;
    --ink-soft: #5C6B68;
    --paper: #F7F8F7;
    --card: #FFFFFF;
    --line: #DFE5E3;
    --warn: #B97B1F;
    --crit: #B3443B;
    --radius: 10px;
    --rail-w: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font: 15px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: var(--paper);
}
h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 650; margin: 24px 0 10px; }
a { color: var(--brand-dark); }
table { font-variant-numeric: tabular-nums; }

/* work-as banner */
.acting-banner {
    background: var(--brand-dark); color: #fff; padding: 8px 16px; font-size: 13.5px;
}

/* ---- shell -------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.rail {
    width: var(--rail-w); flex: 0 0 var(--rail-w);
    background: var(--card); border-inline-end: 1px solid var(--line);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.rail-brand { display: block; padding: 18px 16px 12px; }
.rail-brand img { max-width: 100%; max-height: 54px; display: block; }
.rail-brand-name { font-weight: 700; font-size: 17px; color: var(--brand-dark); }
.rail-nav { flex: 1; overflow-y: auto; padding: 6px 0; }
.rail-nav a {
    display: block; padding-block: 8px; padding-inline: 13px 16px; color: var(--ink-soft);
    text-decoration: none; border-inline-start: 3px solid transparent;
}
.rail-nav a:hover { color: var(--ink); background: var(--paper); }
.rail-nav a.active {
    color: var(--brand-dark); border-inline-start-color: var(--brand-primary);
    background: var(--brand-tint); font-weight: 600;
}
.rail-group {
    padding: 14px 16px 4px; font-size: 12.5px; color: var(--ink-soft);
}
.rail-foot { border-top: 1px solid var(--line); padding: 12px 16px; font-size: 13px; }
.rail-user { font-weight: 600; margin-bottom: 2px; }

.content { flex: 1; padding: 24px 28px 12px; max-width: 1180px; }
.site-foot {
    margin-top: 40px; padding: 14px 0; border-top: 1px solid var(--line);
    color: var(--ink-soft); font-size: 12.5px;
}
.powered-by { color: var(--ink-soft); }

/* ---- page header -------------------------------------------------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head .sub { color: var(--ink-soft); font-size: 13.5px; }

/* ---- cards & tables ----------------------------------------------------- */
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px 20px; margin-bottom: 18px;
}
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
    text-align: start; font-weight: 600; font-size: 13px; color: var(--ink-soft);
    padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: var(--paper); }
.num { text-align: end; }

/* pills */
.pill {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: 12.5px; font-weight: 600; white-space: nowrap;
    background: var(--brand-tint); color: var(--brand-dark);
}
.pill.off { background: #EEE; color: var(--ink-soft); }
.pill.warn { background: #F7ECD9; color: var(--warn); }
.pill.crit { background: #F6E3E1; color: var(--crit); }

/* ---- forms --------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; }
.form-grid .full { grid-column: 1 / -1; }
label.fld { display: block; font-size: 13.5px; }
label.fld span { display: block; margin-bottom: 4px; color: var(--ink-soft); }
input[type=text], input[type=email], input[type=number], input[type=password], input[type=date], select, textarea {
    width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px;
    font: inherit; color: var(--ink); background: var(--card);
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--brand-primary); outline-offset: 1px;
}

/* toggle switch */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; }
.switch .knob {
    width: 40px; height: 22px; border-radius: 999px; background: #CBD4D2;
    position: relative; transition: background .15s ease;
}
.switch .knob::after {
    content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px;
    border-radius: 50%; background: #fff; transition: inset-inline-start .15s ease;
}
.switch input:checked + .knob { background: var(--brand-primary); }
.switch input:checked + .knob::after { inset-inline-start: 21px; }
.switch input:focus-visible + .knob { outline: 2px solid var(--brand-primary); outline-offset: 1px; }

/* ---- buttons ------------------------------------------------------------- */
.btn {
    display: inline-block; padding: 8px 16px; border-radius: 7px; border: 1px solid transparent;
    font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
    background: var(--brand-primary); color: #fff;
}
.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: var(--card); color: var(--brand-dark); border-color: var(--line); }
.btn.secondary:hover { background: var(--brand-tint); }
.btn-link { background: none; border: none; padding: 0; color: var(--brand-dark); cursor: pointer; font: inherit; text-decoration: underline; }

.alert { border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.alert.ok { background: var(--brand-tint); color: var(--brand-dark); }
.alert.warn { background: #F7ECD9; color: var(--warn); }

/* ---- sign-in ------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--paper); }
.login-card {
    width: min(430px, 92vw); background: var(--card); border: 1px solid var(--line);
    border-radius: 14px; padding: 34px 34px 28px; position: relative; overflow: hidden;
}
.login-card::before {
    content: ""; position: absolute; inset: -60% -30% auto; height: 120%;
    border: 14px solid var(--brand-accent); border-radius: 50%;
    transform: rotate(-16deg); opacity: .28; pointer-events: none;
}
.login-card img { max-height: 64px; margin-bottom: 10px; position: relative; }
.login-tagline { color: var(--ink-soft); margin: 0 0 20px; position: relative; }

@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .rail { width: 100%; flex: none; height: auto; position: static; }
    .form-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
