/* Ankit Sethiya & Co. — Audit & Attendance
   Restrained operational UI: neutral surfaces, one accent, dense tables, no decorative effects. */

:root {
    --bg: #f3f4f6;
    --surface: #ffffff;
    --surface-alt: #f8f9fa;
    --border: #d6d9de;
    --border-strong: #b9bec6;
    --text: #1c2230;
    --text-muted: #5b6474;
    --accent: #1f4e79;
    --accent-hover: #173c5e;
    --accent-soft: #e8eef5;
    --nav-bg: #1c2733;
    --nav-text: #c9d1db;
    --nav-active: #ffffff;

    --ok: #1e6b3a;      --ok-bg: #e6f2ea;
    --warn: #7a5200;    --warn-bg: #fbf0d9;
    --bad: #9f2328;     --bad-bg: #fbe8e9;
    --info: #1f4e79;    --info-bg: #e6eef6;
    --neutral: #3f4856; --neutral-bg: #eceef1;

    --radius: 3px;
    --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: Consolas, "SFMono-Regular", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font: 14px/1.45 var(--font);
    color: var(--text);
    background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.25; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
code { font-family: var(--mono); font-size: 12.5px; }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */
.topbar {
    display: flex; align-items: center; gap: 16px;
    height: 52px; padding: 0 16px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; flex-direction: column; color: var(--text); line-height: 1.15; }
.brand:hover { text-decoration: none; }
.brand-name { font-weight: 600; font-size: 15px; }
.brand-sub { font-size: 11.5px; color: var(--text-muted); letter-spacing: .02em; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 13px; }
.topbar-name { font-weight: 600; }
.topbar-role { color: var(--text-muted); }
.nav-toggle { display: none; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.link-button:hover { text-decoration: underline; }
form.inline { display: inline; }

.shell { display: flex; min-height: calc(100vh - 52px); }
.sidenav {
    width: 212px; flex: 0 0 212px;
    background: var(--nav-bg); color: var(--nav-text);
    padding: 12px 0;
}
.nav-group { margin-bottom: 14px; }
.nav-group-label { padding: 4px 18px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #8793a3; }
.sidenav a { display: block; padding: 7px 18px; color: var(--nav-text); border-left: 3px solid transparent; }
.sidenav a:hover { background: rgba(255,255,255,.05); text-decoration: none; color: var(--nav-active); }
.sidenav a.active { color: var(--nav-active); border-left-color: #6fa3d6; background: rgba(255,255,255,.07); font-weight: 600; }
.main { flex: 1; min-width: 0; padding: 20px 24px 48px; max-width: 1400px; }

/* ---------- Page structure ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-sub { margin: 3px 0 0; color: var(--text-muted); font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section { margin-bottom: 16px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 8px; font-weight: 600; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.panel.narrow { max-width: 560px; }
.panel-danger { border-color: #e2b5b7; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.split > .panel { margin-bottom: 0; }
.split + * { margin-top: 16px; }
.split-wide-left { grid-template-columns: 3fr 2fr; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.dl dt { color: var(--text-muted); }
.dl dd { margin: 0; }
.dl-inline { grid-template-columns: repeat(4, max-content 1fr); }

.prose { white-space: normal; }
.h-small { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: 12px 0 4px; }
.h-small:first-child { margin-top: 0; }
.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.summary-line { margin: 0 0 10px; }
.plain-list { margin: 0; padding-left: 18px; }
.steps { margin: 0 0 12px; padding-left: 20px; }
.steps li { margin-bottom: 4px; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- Alerts and badges ---------- */
.alert { padding: 10px 12px; border: 1px solid; border-radius: var(--radius); margin-bottom: 14px; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert-success { background: var(--ok-bg); border-color: #b9dbc5; color: #164f2b; }
.alert-error { background: var(--bad-bg); border-color: #ebc0c2; color: #7d1b1f; }
.alert-warn { background: var(--warn-bg); border-color: #ead39f; color: #5e3f00; }
.alert-info { background: var(--info-bg); border-color: #c4d5e8; color: #1b3f62; }
.secret { display: inline-block; margin: 4px 0; padding: 3px 8px; background: #fff; border: 1px solid var(--border-strong); font-size: 15px; letter-spacing: .04em; user-select: all; }

.badge { display: inline-block; padding: 1px 7px; border-radius: 2px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; vertical-align: 1px; }
.badge-ok { color: var(--ok); background: var(--ok-bg); border-color: #c3e0cc; }
.badge-warn { color: var(--warn); background: var(--warn-bg); border-color: #efd9a6; }
.badge-bad { color: var(--bad); background: var(--bad-bg); border-color: #efc6c8; }
.badge-info { color: var(--info); background: var(--info-bg); border-color: #c9d9ea; }
.badge-neutral { color: var(--neutral); background: var(--neutral-bg); border-color: #d9dde3; }
.badge-muted { color: #6b7380; background: #f1f2f4; border-color: #e1e4e8; font-weight: 500; }

/* ---------- Buttons and forms ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 32px; padding: 5px 12px;
    font: inherit; font-weight: 600; font-size: 13px;
    color: var(--text); background: var(--surface);
    border: 1px solid var(--border-strong); border-radius: var(--radius);
    cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-alt); text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible {
    outline: 2px solid #6fa3d6; outline-offset: 1px;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--bad); border-color: #d9a3a6; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--accent); }
.btn-small { min-height: 26px; padding: 2px 9px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-large { min-height: 44px; font-size: 15px; padding: 8px 20px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

fieldset { border: 0; padding: 0; margin: 0 0 18px; }
legend { font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: 0; margin-bottom: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field label { font-weight: 600; font-size: 13px; }
.optional { font-weight: 400; color: var(--text-muted); font-size: 12px; }
.hint { font-size: 12px; color: var(--text-muted); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
    width: 100%; min-height: 34px; padding: 6px 8px;
    font: inherit; color: var(--text); background: #fff;
    border: 1px solid var(--border-strong); border-radius: var(--radius);
}
textarea { min-height: 0; resize: vertical; }
input[type=file] { font: inherit; font-size: 13px; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--accent); vertical-align: -3px; }
.stack > .field:last-of-type { margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.form-actions { display: flex; gap: 8px; padding-top: 6px; }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { margin-bottom: 0; }
.field-grow { flex: 1 1 220px; }
.field-actions { flex-direction: row; gap: 6px; }
.field-check { justify-content: flex-end; padding-bottom: 6px; }
.field-check label { font-weight: 400; display: flex; gap: 6px; align-items: center; }
.inline-form { display: flex; gap: 6px; }
.inline-form input { min-width: 120px; min-height: 28px; padding: 3px 6px; }

.filters {
    display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
    padding: 10px 12px; margin-bottom: 12px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.filters .field { margin-bottom: 0; }
.filters .field:not(.field-grow) { flex: 0 1 180px; }
.filters .field-actions { flex: 0 0 auto; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 12px; flex-wrap: wrap; }
.tabs a { padding: 7px 12px; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; font-size: 13px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; }
.panel .table-wrap { border: 0; margin-bottom: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 7px 10px; border-bottom: 1px solid #e6e8eb; text-align: left; vertical-align: top; }
.table th { background: var(--surface-alt); font-weight: 600; color: #3a4352; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.table th.num, .table td.num { text-align: right; }
.table th.center, .table td.center { text-align: center; }
.table tbody tr:hover { background: #fafbfc; }
.table tbody tr:last-child td { border-bottom: 0; }
.row-muted td { color: var(--text-muted); }
.row-void td { color: #8a929e; text-decoration: line-through; text-decoration-color: #b8bec7; }
.row-void td form, .row-void td .badge, .row-void td .muted { text-decoration: none; }
.table-edit td { padding: 6px; }
.table-edit input, .table-edit select, .table-edit textarea { min-height: 30px; padding: 4px 6px; font-size: 13px; }
.table-edit textarea + input { margin-top: 4px; }
.w-order { width: 80px; }
.w-section { width: 160px; }
.w-type { width: 170px; }
.w-num { width: 40px; }
.w-answer { width: 120px; }
.check-table { max-height: 360px; overflow-y: auto; border: 1px solid var(--border) !important; }
.log-details { max-width: 420px; word-break: break-word; font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; padding: 4px 2px; flex-wrap: wrap; }
.pager-links { display: flex; gap: 14px; }

.empty { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 24px; text-align: center; }
.empty p { margin: 4px 0; }
.empty-inline { color: var(--text-muted); margin: 4px 0; }

/* ---------- Dashboard ---------- */
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.metric { display: flex; flex-direction: column; padding: 12px 14px; color: var(--text); border-right: 1px solid #e6e8eb; border-bottom: 1px solid #e6e8eb; margin: 0 -1px -1px 0; }
a.metric:hover { background: var(--accent-soft); text-decoration: none; }
.metric-value { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.metric-label { font-weight: 600; font-size: 13px; margin-top: 2px; }
.metric-def { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Attendance ---------- */
.geo .dl { margin-bottom: 12px; }
.geo-capture { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.geo-result { padding: 10px 12px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius); }
.note-box { margin-top: 16px; padding: 10px 12px; font-size: 12.5px; color: var(--text-muted); background: var(--surface-alt); border-left: 3px solid var(--border-strong); }
.note-box strong { color: var(--text); }

/* ---------- Reports ---------- */
.checklist-section { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.checklist-section:first-of-type { margin-top: 4px; }
.checklist { list-style: none; margin: 0; padding: 0; counter-reset: q; border: 1px solid var(--border); border-radius: var(--radius); }
.checklist-item { display: grid; grid-template-columns: 1fr 340px; gap: 12px; padding: 10px 12px; border-bottom: 1px solid #e6e8eb; counter-increment: q; }
.checklist-item:last-child { border-bottom: 0; }
.checklist-q::before { content: counter(q) ". "; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.checklist-a { display: flex; flex-direction: column; gap: 6px; }
.checklist-item.is-missing { background: var(--bad-bg); box-shadow: inset 3px 0 0 var(--bad); }
.radio-group { display: flex; gap: 4px; }
.radio-group label { flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 5px 6px; border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; font-size: 13px; background: #fff; }
.radio-group label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.remarks { font-size: 13px; }
.finding { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: var(--surface-alt); }
.grid-finding { display: grid; grid-template-columns: 1fr 140px 160px; gap: 0 12px; }
.remove-check { font-size: 12.5px; color: var(--text-muted); display: flex; gap: 6px; align-items: center; }
.sticky-actions {
    position: sticky; bottom: 0; z-index: 5;
    display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
    padding: 10px 12px; margin-bottom: 16px;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
}
.sticky-actions input { flex: 1 1 200px; width: auto; }
.table-report { table-layout: fixed; min-width: 560px; }
.table-report td { overflow-wrap: anywhere; }
.report-block h2 { margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.ans-yes { color: var(--ok); font-weight: 600; }
.ans-no { color: var(--bad); font-weight: 600; }
.ans-na { color: var(--text-muted); }
.finding-view { padding: 10px 0; border-bottom: 1px solid #e6e8eb; }
.finding-view:last-child { border-bottom: 0; }
.finding-view h3 { margin-bottom: 8px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 14px; border-left: 2px solid var(--border); margin-left: 4px; }
.timeline li + li { border-top: 1px solid #eef0f2; }
.review-panel { border-color: #9ebad6; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.thumb { width: 140px; font-size: 12px; color: var(--text-muted); }
.thumb img { display: block; width: 140px; height: 105px; object-fit: cover; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt); }
.thumb span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; }
.upload-form { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

.confirm-dialog { max-width: 440px; width: calc(100% - 32px); padding: 18px; border: 1px solid var(--border-strong); border-radius: var(--radius); color: var(--text); }
.confirm-dialog::backdrop { background: rgba(28, 34, 48, .45); }
.confirm-message { margin: 0 0 16px; }
.confirm-dialog .form-actions { justify-content: flex-end; }

/* ---------- Sign-in and errors ---------- */
body.plain { background: var(--bg); }
.plain-wrap { max-width: 420px; margin: 8vh auto 40px; padding: 0 16px; }
.plain-brand { margin-bottom: 18px; }
.plain-brand .brand-name { font-size: 20px; display: block; }
.plain-brand .brand-sub { font-size: 13px; display: block; margin-top: 2px; }
.plain-panel h1 { margin-bottom: 14px; }
.error-panel { max-width: 560px; }
.error-code { font-family: var(--mono); color: var(--text-muted); font-size: 13px; margin-bottom: 4px; }
.error-panel h1 { margin-bottom: 8px; }

/* ---------- Print documents ---------- */
body.print-doc { background: #fff; max-width: 1000px; margin: 0 auto; padding: 24px; font-size: 13px; }
.print-toolbar { display: flex; gap: 12px; align-items: center; padding: 10px 12px; margin-bottom: 20px; background: var(--surface-alt); border: 1px solid var(--border); }
.doc-header { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 12px; margin-bottom: 16px; border-bottom: 2px solid var(--text); }
.doc-firm { font-size: 18px; font-weight: 700; }
.doc-firm-sub { font-size: 13px; }
.doc-firm-addr { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.doc-meta { text-align: right; font-size: 12px; color: var(--text-muted); }
.doc-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 12px; }
.doc-table th, .doc-table td { border: 1px solid #9aa1ab; padding: 4px 6px; text-align: left; vertical-align: top; }
.doc-table th { background: #eef0f2; font-weight: 600; }
.doc-table td.num { text-align: right; }
.doc-kv th { width: 15%; }
.doc-h { font-size: 14px; margin: 18px 0 8px; padding-bottom: 3px; border-bottom: 1px solid #9aa1ab; }
.doc-h3 { font-size: 13px; margin: 10px 0 4px; }
.doc-prose { margin-bottom: 8px; }
.doc-signoff { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 28px; padding-top: 12px; border-top: 1px solid #9aa1ab; break-inside: avoid; }
.doc-sign-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 4px; }
.doc-foot { margin-top: 24px; font-size: 11px; color: var(--text-muted); }
.doc-watermark { padding: 6px 10px; margin-bottom: 12px; border: 1px solid var(--bad); color: var(--bad); font-weight: 600; }
.doc-scope { margin: 0 0 10px; }

@media print {
    @page { size: A4; margin: 14mm 12mm; }
    body.print-doc { padding: 0; max-width: none; }
    .no-print { display: none !important; }
    .doc-table thead { display: table-header-group; }
    .doc-table tr { break-inside: avoid; }
    .doc-h { break-after: avoid; }
    a { color: inherit; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .dl-inline { grid-template-columns: max-content 1fr max-content 1fr; }
}
@media (max-width: 900px) {
    .split, .split-wide-left { grid-template-columns: 1fr; }
    .split > .panel + .panel { margin-top: 0; }
    .checklist-item { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
    .nav-toggle { display: inline-flex; min-height: 32px; padding: 4px 10px; font: inherit; font-weight: 600; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); }
    .topbar { gap: 10px; padding: 0 12px; }
    .topbar-role, .topbar-name, .topbar-user a { display: none; }
    .brand-sub { display: none; }
    .brand { min-width: 0; }
    .brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .topbar-user { flex: 0 0 auto; }
    .shell { display: block; }
    .sidenav { display: none; width: auto; position: sticky; top: 52px; z-index: 15; max-height: calc(100vh - 52px); overflow-y: auto; }
    .sidenav.open { display: block; }
    .main { padding: 14px 12px 40px; }
    .grid-2, .grid-3, .grid-finding { grid-template-columns: 1fr; }
    .dl, .dl-inline { grid-template-columns: max-content 1fr; }
    .filters .field:not(.field-grow) { flex: 1 1 140px; }
    .page-head { flex-direction: column; }
    .doc-header { flex-direction: column; }
    .doc-meta { text-align: left; }
    .doc-signoff { grid-template-columns: 1fr; }
    body.print-doc { padding: 12px; }
}
