/* Stonsys Admin — one console for Toolssys, STCafe, Status and Stonsys Pay.
   Ink sidebar with a circuit "trace" (from the Stonsys mark); quiet paper content; Stonsys blue for actions. */
:root {
    --sa-blue: #289DD2;        /* Stonsys brand: actions, active state */
    --sa-blue-ink: #1B7FAE;    /* hover / pressed, readable on white */
    --sa-ink: #0F2A3A;         /* sidebar, headings */
    --sa-ink-2: #3E5566;
    --sa-mute: #6B7F8D;
    --sa-paper: #F3F6F8;
    --sa-panel: #FFFFFF;
    --sa-line: #DCE4EA;
    --sa-line-soft: #EBF0F3;
    --sa-warn: #C77700;
    --sa-r: 8px;
    --sa-font: "IBM Plex Sans", "Noto Sans Tamil", system-ui, -apple-system, "Segoe UI", sans-serif;
    --bs-primary: var(--sa-blue);
    --bs-primary-rgb: 40, 157, 210;
    --bs-body-font-family: var(--sa-font);
    --bs-body-color: var(--sa-ink);
    --bs-body-bg: var(--sa-paper);
    --bs-border-color: var(--sa-line);
    --bs-link-color: var(--sa-blue-ink);
    --bs-link-color-rgb: 27, 127, 174;
    --bs-link-hover-color: var(--sa-ink);
}
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--sa-font); font-size: 15px; line-height: 1.5; color: var(--sa-ink); background: var(--sa-paper); font-variant-numeric: tabular-nums; }
a { text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--sa-blue); outline-offset: 2px; }
body.sa-lock { overflow: hidden; }

/* ---------- shell ---------- */
.sa-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sa-side { position: sticky; top: 0; height: 100vh; background: var(--sa-ink); color: #C9D6DF; display: flex; flex-direction: column; padding: 20px 0 0; }
.sa-logo { display: block; padding: 2px 22px 20px; flex: none; }
.sa-logo img { display: block; height: 33px; width: auto; }

/* only the menu scrolls; logo and the signed-in footer always stay in view */
.sa-nav { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 0 12px 12px 0; scrollbar-width: none;
          /* the trace line is a background that scrolls with the menu, so it runs the full length however far you scroll */
          background: linear-gradient(rgba(201, 214, 223, .16), rgba(201, 214, 223, .16)) no-repeat 26px 6px / 1.5px calc(100% - 12px); background-attachment: local; }
.sa-nav::-webkit-scrollbar { display: none; }
.sa-group { list-style: none; margin: 0; padding: 0; }
.sa-group-top { margin-bottom: 14px; }
.sa-product { margin: 0 0 14px; }
.sa-product-name { position: relative; margin: 0 0 4px; padding: 0 0 0 44px; font-size: 12.5px; font-weight: 600; color: #EAF1F5; line-height: 22px; }
.sa-node { position: absolute; left: 21px; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--sa-ink); border: 2.5px solid var(--tint); box-sizing: border-box; }
.sa-product.is-soon .sa-product-name { color: #8DA2B0; }
.sa-product.is-soon .sa-node { border-color: #4C6474; }
.sa-item { position: relative; }
.sa-item a, .sa-item > span { display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 44px; border-radius: 0 6px 6px 0; color: #B8C7D1; text-decoration: none; font-size: 14px; line-height: 1.35; }
.sa-item a i, .sa-item > span i { font-size: 16px; opacity: .8; flex: none; }
.sa-item a:hover { color: #FFFFFF; background: rgba(255, 255, 255, .05); }
.sa-item.is-on a { color: #FFFFFF; background: rgba(40, 157, 210, .16); }
.sa-item.is-on::before { content: ""; position: absolute; left: 23.5px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--sa-blue); box-shadow: 0 0 0 3px rgba(40, 157, 210, .25); }
.sa-item.is-soon > span { color: #6F8695; cursor: default; font-size: 13px; }
.sa-me { flex: none; margin: 0 14px; padding: 12px 10px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid rgba(201, 214, 223, .14);
         display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; font-size: 13px; }
.sa-me-name { color: #EAF1F5; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-me-role { color: #8DA2B0; grid-row: 2; }
.sa-me-out { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: #B8C7D1; text-decoration: none; display: inline-flex; gap: 4px; align-items: center; }
.sa-me-out:hover { color: #FFFFFF; }

.sa-main { min-width: 0; display: flex; flex-direction: column; }
.sa-head { display: flex; align-items: flex-end; gap: 16px; padding: 26px 32px 14px; }
.sa-title { flex: 1; min-width: 0; }
.sa-title h1 { margin: 0; font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; color: var(--sa-ink); }
.sa-title p { margin: 4px 0 0; color: var(--sa-ink-2); font-size: 14px; }
.sa-crumb { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--sa-ink-2); margin-bottom: 4px; }
.sa-crumb::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--tint); }
.sa-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sa-menu { display: none; border: 1px solid var(--sa-line); background: var(--sa-panel); border-radius: 6px; width: 40px; height: 40px; font-size: 20px; color: var(--sa-ink); }
.sa-content { padding: 4px 32px 48px; max-width: 1360px; width: 100%; }
.sa-flash { margin-bottom: 18px; }
.sa-scrim { position: fixed; inset: 0; background: rgba(15, 42, 58, .45); z-index: 40; }

/* ---------- Today ---------- */
.sa-today { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.sa-board { background: var(--sa-panel); border: 1px solid var(--sa-line); border-radius: var(--sa-r); }
.sa-board-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--sa-line-soft); }
.sa-board-head h2 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; display: flex; align-items: center; gap: 8px; }
.sa-board-head h2::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 2.5px solid var(--tint, var(--sa-blue)); }
.sa-board-head a { font-size: 13px; }
.sa-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.sa-fig { padding: 14px 18px 16px; border-right: 1px solid var(--sa-line-soft); border-bottom: 1px solid var(--sa-line-soft); }
.sa-fig dt { font-size: 13px; font-weight: 400; color: var(--sa-ink-2); }
.sa-fig dd { margin: 2px 0 0; font-size: 22px; font-weight: 600; color: var(--sa-ink); line-height: 1.25; }
.sa-fig dd small { font-size: 13px; font-weight: 400; color: var(--sa-mute); margin-left: 5px; }
.sa-fig.is-attn dd { color: var(--sa-warn); }
.sa-board + .sa-board { margin-top: 20px; }
.sa-pending { padding: 12px 18px; color: var(--sa-ink-2); font-size: 14px; }
.sa-feed { list-style: none; margin: 0; padding: 4px 0; }
.sa-feed li { padding: 10px 18px; border-bottom: 1px solid var(--sa-line-soft); font-size: 13.5px; }
.sa-feed li:last-child { border-bottom: 0; }
.sa-feed .who { font-weight: 500; }
.sa-feed .when { display: block; color: var(--sa-mute); font-size: 12.5px; }
.sa-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--tint); }

/* ---------- Bootstrap, re-themed ---------- */
.card { border: 1px solid var(--sa-line); border-radius: var(--sa-r); box-shadow: none; background: var(--sa-panel); }
.card-body { padding: 18px; }
.table { --bs-table-bg: transparent; --bs-table-hover-bg: #F6F9FB; color: var(--sa-ink); margin: 0; font-size: 14px; }
.table > :not(caption) > * > * { padding: 11px 14px; border-bottom-color: var(--sa-line-soft); }
.table tr:first-child > th, .table thead th { font-size: 12.5px; font-weight: 500; color: var(--sa-ink-2); background: #F8FAFB; border-bottom: 1px solid var(--sa-line); white-space: nowrap; }
.table tr:last-child > td { border-bottom: 0; }
.form-control, .form-select { background-color: #FFFFFF; border-color: var(--sa-line); border-radius: 6px; font-size: 14.5px; min-height: 40px; color: var(--sa-ink); }
.form-control-sm, .form-select-sm { min-height: 32px; font-size: 13.5px; }
.form-control:focus, .form-select:focus { background-color: #FFFFFF; border-color: var(--sa-blue); box-shadow: 0 0 0 3px rgba(40, 157, 210, .18); }
.form-label { font-size: 13.5px; font-weight: 500; color: var(--sa-ink-2); margin-bottom: 5px; }
.form-check-input:checked { background-color: var(--sa-blue); border-color: var(--sa-blue); }
.btn { border-radius: 6px; font-weight: 500; font-size: 14px; padding: 8px 14px; }
.btn-sm { font-size: 13px; padding: 5px 10px; }
.btn-primary { --bs-btn-bg: var(--sa-blue); --bs-btn-border-color: var(--sa-blue); --bs-btn-hover-bg: var(--sa-blue-ink); --bs-btn-hover-border-color: var(--sa-blue-ink);
               --bs-btn-active-bg: #176C94; --bs-btn-active-border-color: #176C94; --bs-btn-disabled-bg: #8CC8E5; --bs-btn-disabled-border-color: #8CC8E5; }
.btn-outline-primary { --bs-btn-color: var(--sa-blue-ink); --bs-btn-border-color: #A9D5EA; --bs-btn-hover-bg: var(--sa-blue); --bs-btn-hover-border-color: var(--sa-blue); }
.btn-light, .btn-outline-secondary { --bs-btn-bg: var(--sa-panel); --bs-btn-color: var(--sa-ink); --bs-btn-border-color: var(--sa-line); --bs-btn-hover-bg: #EEF3F6; --bs-btn-hover-border-color: #C9D5DD; --bs-btn-hover-color: var(--sa-ink); }
.badge { font-weight: 500; border-radius: 999px; padding: .35em .65em; }
.badge.bg-success { background: #E3F4EC !important; color: #12704B; }
.badge.bg-danger { background: #FBE7E8 !important; color: #A1262C; }
.badge.bg-warning { background: #FFF1D9 !important; color: #8A5300 !important; }
.badge.bg-secondary { background: #EAEFF2 !important; color: var(--sa-ink-2); }
.badge.bg-primary, .badge.bg-info { background: #E1F1F9 !important; color: #156B93; }
.alert { border-radius: var(--sa-r); font-size: 14px; }
.alert-success { background: #ECF8F2; border-color: #BFE6D3; color: #0F5E3F; }
.alert-danger { background: #FDF0F1; border-color: #F2C4C7; color: #8E2026; }
.alert-warning { background: #FFF6E6; border-color: #F4D9A8; color: #7A4A00; }
.alert-info { background: #ECF6FB; border-color: #C3E2F1; color: #135E81; }
.text-muted { color: var(--sa-mute) !important; }
.sa-empty { text-align: center; padding: 56px 20px; color: var(--sa-ink-2); }
.sa-empty i { font-size: 30px; color: var(--sa-mute); }
.sa-note { font-size: 13px; color: var(--sa-mute); }

/* ---------- sign-in ---------- */
.sa-auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--sa-paper); }
.sa-auth-box { width: 100%; max-width: 400px; }
.sa-auth-logo { display: block; height: 40px; width: auto; margin: 0 auto 28px; }
.sa-auth-panel { background: var(--sa-panel); border: 1px solid var(--sa-line); border-radius: 10px; padding: 26px; }
.sa-auth-panel h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.sa-auth-panel > p { color: var(--sa-ink-2); font-size: 14px; margin: 0 0 20px; }
.sa-auth-foot { margin-top: 16px; font-size: 13px; color: var(--sa-mute); }
.sa-code { letter-spacing: .35em; font-size: 22px !important; text-align: center; font-weight: 600; }

/* ---------- team ---------- */
.sa-team { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.sa-perm-group { border: 1px solid var(--sa-line-soft); border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; }
.sa-perm-group h3 { font-size: 13.5px; font-weight: 600; margin: 0 0 6px; display: flex; align-items: center; gap: 7px; }
.sa-perm-group h3::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--tint); }
.sa-perm-group .form-check { font-size: 13.5px; margin-bottom: 3px; }

/* ---------- detail pages (STCafe, and the sections that follow) ---------- */
.card-title { font-size: 15px; font-weight: 600; margin: 0 0 12px; color: var(--sa-ink); }
.sa-cols { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); align-items: start; margin-bottom: 20px; }
.sa-split { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.sa-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 18px; margin: 0; font-size: 14px; }
.sa-kv dt { font-weight: 400; color: var(--sa-ink-2); }
.sa-kv dd { margin: 0; word-break: break-word; }
.sa-sub { display: block; font-size: 12.5px; color: var(--sa-mute); margin-top: 1px; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .9em; }
.sa-pager { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--sa-line-soft); }
.card hr { border-color: var(--sa-line); opacity: 1; }
.sa-thread { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.sa-msg { max-width: 86%; padding: 10px 14px; border-radius: 8px; white-space: pre-wrap; word-break: break-word; font-size: 14.5px; }
.sa-msg.is-them { background: #F1F4F6; align-self: flex-start; }
.sa-msg.is-us { background: #E6F3FA; align-self: flex-end; }
.sa-msg.is-note { background: #FFF6E6; border: 1px dashed #E3B868; align-self: flex-end; }
.sa-msg-who { white-space: normal; font-size: 12.5px; color: var(--sa-ink-2); margin-bottom: 4px; }
.sa-msg img { display: block; max-width: 100%; max-height: 320px; margin-top: 8px; border-radius: 6px; border: 1px solid var(--sa-line); }
.sa-doc { overflow-x: auto; }
@media (max-width: 991px) { .sa-split { grid-template-columns: minmax(0, 1fr); } .sa-msg { max-width: 100%; } }
@media print {
    body { background: #fff; }
    .sa-side, .sa-head, .sa-scrim, .sa-flash, .no-print { display: none !important; }
    .sa-shell { display: block; }
    .sa-content { padding: 0; max-width: none; }
    .sa-doc { border: 0; padding: 0; }
}

.sts-twice { background: #FFF8EA; border: 1px solid #F1DDB0; border-radius: 6px; padding: 6px 8px; }

/* ---------- Evening summary ---------- */
.sa-wa { background: #E7F8EE; border: 1px solid #C7EBD5; border-radius: 10px; padding: 14px 16px; font-size: 14.5px; line-height: 1.55; max-width: 520px; word-break: break-word; }
.sa-pre { background: #F4F7F9; border: 1px solid var(--sa-line); border-radius: 6px; padding: 8px 10px; font-size: 12.5px; white-space: pre-wrap; word-break: break-word; margin: 0; }

/* ---------- Status ---------- */
.sa-h2 { font-size: 16px; font-weight: 600; margin: 24px 0 12px; }
.sts-days { display: flex; gap: 2px; align-items: stretch; height: 24px; min-width: 210px; }
.sts-day { flex: 1 1 0; min-width: 4px; border-radius: 2px; background: #2FAF74; }
.sts-day.is-slow { background: #E8A93A; }
.sts-day.is-bad { background: #D9534F; }
.sts-day.is-none { background: #E2E8EC; }
.sts-timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--sa-line); }
.sts-timeline li { position: relative; padding: 0 0 18px 4px; }
.sts-timeline li::before { content: ""; position: absolute; left: -25px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--sa-panel); border: 2.5px solid var(--sa-line); }
.sts-timeline li:first-child::before { border-color: var(--sa-blue); }
.sts-tl-head { margin-bottom: 4px; }
.sts-tl-msg { white-space: pre-wrap; word-break: break-word; }
@media (max-width: 991px) { .sts-days-h, .sts-days-c { display: none; } }

/* ---------- phone ---------- */
@media (max-width: 991px) {
    .sa-shell { grid-template-columns: minmax(0, 1fr); }
    .sa-side { position: fixed; left: 0; top: 0; bottom: 0; height: auto; width: 272px; z-index: 50; transform: translateX(-100%); transition: transform .2s ease;
               padding-top: calc(20px + env(safe-area-inset-top, 0px)); }
    .sa-side.is-open { transform: none; }
    .sa-menu { display: inline-grid; place-items: center; flex: none; }
    .sa-head { padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 12px; align-items: center; flex-wrap: wrap; }
    .sa-title h1 { font-size: 20px; }
    .sa-content { padding: 4px 16px 40px; }
    .sa-today, .sa-team { grid-template-columns: minmax(0, 1fr); }
    .sa-actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .sa-side { transition: none; } }
