/* Samachar Diary – Daily Work Reports
   Clean sidebar + cards layout (time-tracker style) */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --brand: #d71920;        /* news red */
  --brand-dark: #a81118;
  --accent: #4f46e5;       /* action indigo */
  --accent-soft: #eef2ff;
  --ok: #059669; --ok-soft: #ecfdf5;
  --warn: #b45309; --warn-soft: #fffbeb;
  --err: #dc2626; --err-soft: #fef2f2;
  --info: #2563eb; --info-soft: #eff6ff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --font: "Inter", "Noto Sans Gujarati", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: 13px; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h2 { font-size: 16px; margin-bottom: 12px; }
h3 { font-size: 15px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; flex: none; background: var(--surface); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand span { display: flex; flex-direction: column; }
.brand small { color: var(--muted); font-size: 12px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 16px 10px 6px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #374151; font-weight: 500; }
.nav-item:hover { background: var(--surface-2); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 18px; flex: 1; }
.menu-btn { display: none; background: none; border: 0; padding: 6px; cursor: pointer; color: var(--text); }
.who { display: flex; align-items: center; gap: 10px; }
.who-text { display: flex; flex-direction: column; line-height: 1.2; }
.who-text small { color: var(--muted); font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 600; }
.content { padding: 24px 28px 60px; max-width: 1280px; width: 100%; }
.backdrop { display: none; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; background: linear-gradient(160deg, #fff 0%, #fdecec 100%); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: 0 10px 30px rgba(0,0,0,.06); }
.auth-card.wide { max-width: 640px; }
.auth-card h2 { font-size: 20px; margin: 18px 0 4px; }
.auth-card .form { margin-top: 18px; }
.auth-wrap > .alert { width: 100%; max-width: 400px; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand div { display: flex; flex-direction: column; }
.auth-brand strong { font-size: 17px; }
.auth-brand small { color: var(--muted); }

/* ---------- elements ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 18px; }
.cards.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.cards .card { margin: 0; }
.task { border-left: 4px solid var(--warn); }
.task.done { border-left-color: var(--ok); }
.task-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.task p { margin: 8px 0 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 8px; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-light { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-light:hover { background: var(--surface-2); }
.btn-danger-light { background: var(--err-soft); color: var(--err); border-color: #fecaca; }
.btn-block { width: 100%; justify-content: center; }
button.link { background: none; border: 0; padding: 0 0 0 10px; color: var(--accent); font: inherit; cursor: pointer; }
button.link.danger { color: var(--err); }
form.inline { display: inline; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-off { background: #f3f4f6; color: var(--muted); }
.badge-admin { background: #fdecec; color: var(--brand-dark); }
.chip { display: inline-block; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; font-size: 12px; margin: 2px 4px 2px 0; }

.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; }
.alert-success { background: var(--ok-soft); border-color: #a7f3d0; color: #065f46; }
.alert-error { background: var(--err-soft); border-color: #fecaca; color: #991b1b; }
.alert-warn { background: var(--warn-soft); border-color: #fde68a; color: #92400e; }
.alert-info { background: var(--info-soft); border-color: #bfdbfe; color: #1e40af; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat span { color: var(--muted); font-size: 13px; display: block; }
.stat strong { font-size: 24px; display: block; margin-top: 2px; }
.stat strong.small { font-size: 15px; font-weight: 600; }
.stat.ok strong { color: var(--ok); }
.stat.warn strong { color: var(--warn); }
.bar { height: 6px; background: #eef0f4; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }

.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.dept { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; color: var(--text); display: block; }
.dept:hover { background: var(--surface-2); text-decoration: none; }
.dept.on { border-color: var(--accent); background: var(--accent-soft); }
.dept span { font-size: 13px; color: var(--muted); display: block; }
.dept strong { font-size: 18px; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar label { display: flex; align-items: center; gap: 6px; font-weight: 500; color: #374151; }
.toolbar .spacer { flex: 1; }
.toolbar .quick { display: flex; gap: 12px; font-size: 13px; width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg a { padding: 7px 12px; color: var(--text); border-right: 1px solid var(--border); }
.seg a:last-child { border-right: 0; }
.seg a.on { background: var(--accent); color: #fff; }
.seg a:hover { text-decoration: none; }
.small-note { margin: -8px 0 14px; font-size: 13px; }

input, select, textarea {
  font: inherit; color: var(--text); background: #fff; border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 10px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d2fe; border-color: var(--accent); }
textarea { width: 100%; resize: vertical; }
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 500; margin-bottom: 12px; }
.form label input, .form label select, .form label textarea { width: 100%; }
.form h2 { margin-top: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.span-2 { grid-column: span 2; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-bottom: 18px; }
.check { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; cursor: pointer; margin: 0 !important; }
.check input { width: auto !important; accent-color: var(--accent); }
.checks { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.checks .check { border: 0; padding: 4px 0; }
.pw-row { display: flex; gap: 8px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.form-actions.sticky { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 10px; }
.danger-zone { border-top: 1px dashed var(--border); margin-top: 16px; padding-top: 14px; }
.steps { padding-left: 20px; margin: 0 0 14px; }
.steps li { margin-bottom: 6px; }
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 0 0 12px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.cred { border-color: #a7f3d0; background: var(--ok-soft); }
.cred-box { white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; background: #fff; border: 1px solid #a7f3d0; border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-bottom: 12px; align-items: center; }
.meta strong { color: var(--text); }
.admin-note { border-left: 4px solid var(--accent); }
.admin-note p { margin: 6px 0; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.table td { padding: 11px 12px; border-bottom: 1px solid #f0f1f4; vertical-align: top; }
.table tr:hover td { background: #fafbff; }
.table tr.dim td { opacity: .55; }
.table td.c-name { min-width: 170px; }
.table td.summary { font-size: 13px; color: #374151; max-width: 420px; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.pager a { border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; color: var(--text); }
.pager a.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- report sheet (looks like the Excel format) ---------- */
.sheet { background: #fff; border: 1px solid #cfd4dc; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 16px; }
.sheet-title { background: var(--brand); color: #fff; font-weight: 700; text-align: center; padding: 14px 16px; font-size: 16px; letter-spacing: .02em; }
.sheet table { width: 100%; border-collapse: collapse; }
.sheet-head th, .sheet-head td { padding: 9px 12px; border-bottom: 1px solid #e3e6eb; text-align: left; }
.sheet-head th { background: #fbfbfc; font-weight: 600; width: 18%; white-space: nowrap; }
.sheet-head td { width: 32%; }
.sheet-head input { width: 100%; }
.sheet-body th, .sheet-body td { border: 1px solid #e3e6eb; padding: 8px 12px; text-align: left; vertical-align: middle; }
.sheet-body thead th { background: #1f2937; color: #fff; font-weight: 600; font-size: 13px; }
.sheet-body tr.sec td { background: #fdecec; color: var(--brand-dark); font-weight: 700; }
.sheet-body tr.total td, .sheet-body tr.total th { background: #fff7d6; font-weight: 700; }
.sheet-body .c-no { width: 64px; text-align: center; color: var(--muted); }
.sheet-body .c-val { width: 220px; text-align: center; }
.sheet-body .c-val input, .sheet-body .c-val select { width: 100%; text-align: center; }
.sheet-body .c-val input[type=text] { text-align: left; }
.sheet-body td[colspan] input { width: 100%; }
.sheet-body td.note { padding: 10px 12px; min-height: 60px; }
.sheet-body .hint { display: block; color: var(--muted); font-size: 12px; }
.sheet-body .num { font-weight: 600; font-variant-numeric: tabular-nums; }
.sheet-body output { font-variant-numeric: tabular-nums; }
.money { display: flex; align-items: center; gap: 6px; }
.money span { color: var(--muted); }
.grid-wrap { overflow-x: auto; }
.sheet-grid th:first-child { background: #fbfbfc; width: 160px; }
.sheet-grid thead th:first-child { background: #1f2937; }
.sheet-grid .c-val { width: auto; min-width: 110px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  .sidebar.open { transform: none; }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 20; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 16px; }
  .who-text { display: none; }
  .content { padding: 16px 16px 60px; }
  .grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}
@media (max-width: 640px) {
  .sheet-head, .sheet-head tbody, .sheet-head tr { display: block; }
  .sheet-head tr { display: grid; grid-template-columns: 40% 60%; }
  .sheet-head th, .sheet-head td { width: auto; }
  .sheet-body .c-val { width: 120px; }
  .sheet-body .c-no { width: 40px; padding: 8px 4px; }
  .sheet-body th, .sheet-body td { padding: 7px 8px; }
  .sheet-title { font-size: 14px; }
  .toolbar > * { flex: 1 1 auto; }
  .toolbar .spacer { display: none; }
}

/* ---------- print (A4, like the Excel sheet) ---------- */
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 12px; }
  .sidebar, .topbar, .no-print, .alert, .backdrop, .form-actions { display: none !important; }
  .content { padding: 0; max-width: none; }
  .sheet, .card { box-shadow: none; border-radius: 0; }
  .sheet-title, .sheet-body thead th, .sheet-body tr.sec td, .sheet-body tr.total td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .admin-note { page-break-inside: avoid; }
}
