:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #172c28;
  background: #f5f7f6;
  --muted: #5a6d67;
  --border: #dee7e3;
  --green: #076954;
  --green-dark: #075543;
  --mint: #e8f5ef;
  --red: #a33436;
  --sidebar-width: 230px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
h1, h2, h3, p, dl, dd, ol { margin: 0; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid #13876f; outline-offset: 3px; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.sidebar {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  z-index: 2;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 25px 16px 18px;
}
.brand { display: flex; align-items: center; gap: 11px; align-self: flex-start; margin: 1px 0 37px 6px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #08604d; color: #fff; }
.brand-mark .icon { width: 23px; height: 23px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: -.25px; }
.brand small { font-size: 12px; color: var(--muted); margin-top: 1px; }
.navigation { display: grid; gap: 5px; }
.nav-caption { padding: 0 11px 5px; color: var(--muted); font-size: 10px; letter-spacing: .13em; font-weight: 750; }
.nav-link { min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 9px 10px; color: #4b6059; font-size: 13px; font-weight: 650; border-radius: 8px; }
.nav-link:hover { background: #f1f6f3; }
.nav-link[aria-current] { background: var(--mint); color: var(--green-dark); box-shadow: inset 3px 0 #16836b; }
.nav-link .icon { width: 18px; height: 18px; }
.nav-count { margin-left: auto; min-width: 21px; text-align: center; padding: 2px 5px; background: #d8eee5; border-radius: 20px; font-size: 11px; }
.sidebar-bottom { margin-top: auto; }
.install { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 46px; padding: 8px 9px; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: #284a40; font-weight: 650; font-size: 12px; text-align: left; }
.install:hover { background: var(--mint); }
.install > .icon { width: 15px; height: 15px; color: var(--green); }
.install-icon { display: grid; place-items: center; padding: 4px; border-radius: 6px; background: var(--mint); color: var(--green); }
.install-icon .icon { width: 16px; height: 16px; }
.offline-status { margin: 13px 0 0 3px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.status-dot { width: 7px; height: 7px; background: #329778; border-radius: 50%; box-shadow: 0 0 0 3px #e5f3ed; }

.workspace { margin-left: var(--sidebar-width); }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 63px; padding: 0 clamp(20px, 3vw, 44px); background: #fff; border-bottom: 1px solid var(--border); }
.breadcrumbs { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.breadcrumbs .icon { width: 13px; height: 13px; color: #72857e; }
.breadcrumbs strong { color: #203931; font-weight: 650; }
.location-pill { display: flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid var(--border); border-radius: 7px; font-size: 12px; color: #39594d; font-weight: 650; }
.location-pill .icon { width: 14px; height: 14px; color: var(--green); }
.content { max-width: 1350px; margin: 0 auto; padding: 26px clamp(20px, 3vw, 44px) 0; }

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 190px;
  overflow: hidden;
  padding: 27px 32px;
  border-radius: 16px;
  color: white;
  background: linear-gradient(105deg, #103d35 0%, #0c5043 54%, #0b6b56 100%);
}
.hero img { position: absolute; z-index: -1; height: 100%; width: auto; right: 0; bottom: 0; object-fit: contain; object-position: right bottom; }
.hero-content { max-width: 62%; }
.hero .hero-kicker { display: inline-flex; align-items: center; gap: 6px; background: #ffffff16; border: 1px solid #ffffff26; color: #d9faeb; padding: 4px 8px; border-radius: 6px; font-size: 10px; font-weight: 750; letter-spacing: .13em; }
.hero-kicker .icon { width: 14px; height: 14px; }
.hero h1 { margin: 10px 0 6px; font-size: clamp(27px, 3.05vw, 43px); letter-spacing: -.046em; line-height: 1.13; }
.hero p { color: #daf0e7; font-size: 14px; line-height: 1.5; }

.form-layout { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(225px, 1fr); align-items: start; gap: 22px; margin-top: 22px; }
.card { border: 1px solid var(--border); border-radius: 13px; background: #fff; box-shadow: 0 2px 5px #15382b06; }
.form-card { padding: 23px 24px 21px; }
.card-intro { display: flex; align-items: center; gap: 12px; margin-bottom: 23px; }
.section-icon { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; background: var(--mint); color: var(--green); }
.card h2, .dialog-heading h2 { font-size: 19px; line-height: 1.25; letter-spacing: -.4px; }
.card-intro p, .archive-heading p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.fields label, .photo-label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.required { color: #ad4342; }
.input-wrap { position: relative; display: flex; align-items: center; min-width: 0; color: #6c8179; }
.fields > .input-wrap, .fields > .field-row { margin-bottom: 15px; }
.input-wrap .icon { position: absolute; left: 12px; width: 17px; height: 17px; pointer-events: none; }
.input-wrap input, .input-wrap select, .quantity-field input { width: 100%; min-width: 0; min-height: 44px; padding: 9px 11px; border: 1px solid #d6e2dc; border-radius: 8px; background: #fff; color: #172c28; font-size: 14px; }
.input-wrap input { padding-left: 37px; }
.input-wrap input::placeholder { color: #667972; opacity: 1; }
.input-wrap select { appearance: none; padding-right: 32px; text-overflow: ellipsis; }
.input-wrap select:invalid { color: #667972; }
.input-wrap select option { color: #172c28; }
.input-wrap select:disabled { cursor: default; color: #64736e; opacity: 1; background: #f4f6f5; }
.select-wrap .icon { left: auto; right: 10px; width: 15px; height: 15px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.quantity-row { display: flex; align-items: center; gap: 12px; }
.quantity-row small { color: var(--muted); font-size: 12px; }
.quantity-field { display: flex; width: 104px; flex: 0 0 auto; position: relative; align-items: center; }
.quantity-field input { padding-right: 43px; }
.quantity-field span { pointer-events: none; color: var(--muted); font-size: 12px; position: absolute; right: 11px; }

.photo-section { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 17px; }
.photo-heading { display: flex; align-items: center; gap: 8px; }
.photo-heading .icon { color: var(--green); width: 18px; height: 18px; }
.photo-heading h3 { font-size: 15px; }
.photo-section > p { color: var(--muted); font-size: 12px; margin: 5px 0 15px; }
.photo-field { position: relative; min-width: 0; }
.photo-picker { display: grid; justify-items: center; align-content: center; position: relative; overflow: hidden; width: 100%; min-height: 119px; padding: 12px; border: 1px dashed #a9c7ba; border-radius: 9px; background: #f7faf8; color: var(--green-dark); }
.photo-picker:hover { background: var(--mint); border-color: var(--green); }
.photo-picker[aria-invalid="true"] { border-color: var(--red); }
.photo-icon { display: grid; place-items: center; width: 33px; height: 33px; background: #e4f3eb; border-radius: 9px; margin-bottom: 5px; }
.photo-icon .icon { width: 17px; height: 17px; }
.photo-picker strong { font-size: 13px; }
.photo-picker small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.photo-picker.has-photo { border-style: solid; background: #123b31; align-content: end; }
.photo-picker.has-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-picker.has-photo .photo-icon, .photo-picker.has-photo small { display: none; }
.photo-picker.has-photo strong { z-index: 1; background: #13382deb; color: white; padding: 4px 9px; border-radius: 6px; }
.remove-photo { position: absolute; top: 30px; right: 7px; display: grid; place-items: center; width: 36px; height: 36px; color: #172c28; border-radius: 7px; border: 1px solid var(--border); background: #fff; }
.remove-photo:hover, .icon-button:hover { background: var(--mint); }
.remove-photo .icon { width: 16px; height: 16px; }
.field-error, .form-error { color: var(--red); font-size: 13px; margin-top: 7px; }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--border); margin-top: 20px; padding-top: 17px; }
.form-footer p { color: var(--muted); font-size: 12px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 1px solid transparent; padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 700; }
.button .icon { width: 17px; height: 17px; }
.primary { background: var(--green); color: #fff; }
.primary:hover { background: var(--green-dark); }
.primary:disabled, .photo-picker:disabled, .remove-photo:disabled { opacity: .7; cursor: wait; }

.form-aside { display: grid; gap: 14px; }
.progress-card { padding: 19px; }
.progress-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 13px; }
.progress-heading h2 { font-size: 16px; letter-spacing: -.23px; }
.progress-heading span { flex: 0 0 auto; background: var(--mint); color: var(--green-dark); border-radius: 6px; padding: 3px 7px; font-size: 11px; font-weight: 750; }
progress { display: block; width: 100%; height: 6px; border: 0; border-radius: 10px; overflow: hidden; appearance: none; background: #e7efeb; }
progress::-webkit-progress-bar { background: #e7efeb; }
progress::-webkit-progress-value { background: #158166; }
progress::-moz-progress-bar { background: #158166; }
.steps { display: grid; gap: 16px; margin-top: 17px; padding: 0; list-style: none; }
.steps li { position: relative; display: flex; align-items: center; gap: 9px; }
.steps li:not(:last-child)::after { content: ""; position: absolute; width: 1px; height: 12px; left: 13px; top: calc(100% + 2px); background: var(--border); }
.steps strong, .steps small { display: block; }
.steps strong { font-size: 12px; }
.steps small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.step-number { display: grid; place-items: center; width: 27px; height: 27px; flex: 0 0 auto; border-radius: 50%; border: 1px solid #dae7e0; background: #f6f9f7; color: #496359; font-size: 11px; font-weight: 750; }
.step-number .icon { display: none; width: 15px; height: 15px; }
.step-number.complete { background: #dbf3e8; color: var(--green-dark); }
.step-number.complete .icon { display: block; }
.step-number.complete > span { display: none; }
.tip { display: flex; align-items: start; gap: 9px; padding: 14px; background: #eaf4ef; border: 1px solid #dcebe3; border-radius: 10px; color: #244c3d; }
.tip .icon { margin-top: 1px; width: 17px; height: 17px; color: var(--green); }
.tip h2 { font-size: 12px; }
.tip p { color: #45635a; font-size: 12px; line-height: 1.5; margin-top: 4px; }
.page-footer { text-align: center; color: var(--muted); padding: 24px 0 22px; font-size: 12px; }
.page-footer span { margin: 0 2px; }

.archive-card { margin-top: 22px; padding: 23px 24px; }
.archive-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 17px; }
.sync-info { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.sync-info .button { flex: 0 0 auto; border-color: var(--border); background: var(--mint); color: var(--green-dark); }
.sync-info .button:disabled { opacity: .65; cursor: wait; }
.search-wrap { width: min(100%, 260px); }
.record { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; text-align: left; width: 100%; background: #fff; border: 0; border-top: 1px solid var(--border); padding: 12px 2px; color: inherit; }
.record:hover { background: #f3f8f5; }
.record-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; color: var(--green); background: var(--mint); }
.record strong, .record small { display: block; overflow-wrap: anywhere; }
.record strong { font-size: 14px; }
.record small { color: var(--muted); font-size: 12px; margin-top: 3px; }
.record-meta { text-align: right; }
.record-arrow { width: 15px; height: 15px; color: var(--green); }
.empty { text-align: center; padding: 34px 12px; color: var(--muted); border: 1px dashed var(--border); border-radius: 9px; font-size: 14px; }
.empty .button { margin-top: 13px; }

.session-loading { padding: 28px; text-align: center; color: var(--muted); }
.login-view { min-height: 100dvh; display: grid; place-items: center; padding: 18px; }
.login-card { width: min(100%, 420px); padding: clamp(20px, 5vw, 34px); }
.login-card h1 { margin: 6px 0; font-size: clamp(24px, 5vw, 30px); }
.login-card p, .user-hint, #logout-message { color: var(--muted); font-size: 13px; }
.login-card .login-kicker { margin-top: 14px; color: var(--green); font-size: 11px; font-weight: 750; letter-spacing: .08em; }
.login-card label, .user-form label { display: block; margin: 13px 0 6px; font-size: 13px; font-weight: 650; }
.login-card input, .user-form input { padding-inline: 10px; }
.login-card > .button { width: 100%; margin-top: 18px; }
#login-message:not(:empty), #logout-message:not(:empty) { margin-top: 8px; }
.account-panel { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.account-panel strong, .account-panel span { display: block; font-size: 12px; overflow-wrap: anywhere; }
.account-panel span { color: var(--muted); margin-top: 2px; }
.account-panel .button { flex: 0 0 auto; min-height: 36px; padding-inline: 10px; }
.user-form { padding-top: 8px; }
.user-form .button { margin-top: 16px; }
.user-hint { margin-top: 6px; }
.users-table button { min-height: 34px; }
.push-toggle { width: 100%; margin-bottom: 5px; }
.push-status { color: var(--muted); font-size: 11px; margin-bottom: 9px; }
#announcement-form label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 650; }
#announcement-form input, #announcement-form textarea { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 7px; font: inherit; }
#announcement-form textarea { resize: vertical; }
.announcement-meta { color: var(--muted); font-size: 12px; margin-top: 6px; }
.announcement-body { margin-top: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }

.admin-nav-caption { margin-top: 14px; }
.admin-content, .admin-status { margin-top: 20px; }
.admin-content { display: grid; gap: 16px; }
.admin-status { padding: 16px; font-size: 14px; color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 0; }
.metric { border-top: 3px solid #16836b; padding: 16px 19px; }
.metric dt { color: var(--muted); font-size: 13px; font-weight: 650; }
.metric dd { margin: 5px 0 0; color: var(--green-dark); font-size: clamp(21px, 3vw, 33px); font-weight: 750; overflow-wrap: anywhere; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-panel { min-width: 0; padding: 20px; }
.admin-panel-heading { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.admin-panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.secondary { border-color: var(--border); background: var(--mint); color: var(--green-dark); }
.secondary:hover { border-color: var(--green); }
.district-stats, .latest-handovers { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.district-stats li:not(.empty), .latest-handovers li:not(.empty) { display: grid; gap: 5px; border-top: 1px solid var(--border); padding: 11px 0 0; }
.district-stats li span, .latest-handovers li span { color: var(--muted); font-size: 12px; }
.district-stats li progress { width: 100%; height: 7px; }
.report-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 1.4fr) auto; align-items: end; gap: 11px; }
.report-filters label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 650; }
.report-filters input[type="date"] { padding-inline: 10px; }
.report-heading .report-eyebrow { color: var(--green); font-size: 10px; font-weight: 750; letter-spacing: .12em; margin: 0 0 5px; }
#report-totals { color: var(--green-dark); font-weight: 650; }
.report-table-wrap { overflow-x: auto; }
.report-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.report-table th { background: #eaf4ee; color: #294a40; }
.report-table th, .report-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.report-table th:nth-child(2), .report-table td:nth-child(2) { white-space: nowrap; }
.report-table th:last-child, .report-table td:last-child { text-align: right; }
#report-empty { margin-top: 12px; }

dialog { width: min(620px, calc(100% - 30px)); max-height: 90dvh; border: 1px solid var(--border); border-radius: 13px; padding: 21px; color: #172c28; box-shadow: 0 15px 55px #132d2855; }
dialog::backdrop { background: #102c2677; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.dialog-heading h2 { overflow-wrap: anywhere; }
.dialog-heading p { font-size: 10px; font-weight: 750; color: var(--green); letter-spacing: .1em; margin-bottom: 4px; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; background: white; color: #2a4c40; border: 1px solid var(--border); border-radius: 7px; }
.icon-button .icon { width: 16px; height: 16px; }
#detail-data { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; padding: 15px 0; }
#detail-data dt { font-size: 12px; color: var(--muted); }
#detail-data dd { font-size: 14px; font-weight: 650; margin-top: 2px; overflow-wrap: anywhere; }
.detail-photo { display: grid; gap: 5px; min-width: 0; font-size: 13px; }
.detail-photo img { width: 100%; max-height: 220px; object-fit: contain; background: #edf4f0; border-radius: 7px; }
.detail-photo a { color: var(--green-dark); text-decoration: underline; text-underline-offset: 2px; justify-self: start; padding: 5px 0; }
#install-dialog { max-width: 430px; }
#install-help { margin-top: 14px; font-size: 14px; line-height: 1.6; color: var(--muted); }
.toast:not(:empty) { position: fixed; z-index: 3; bottom: max(16px, env(safe-area-inset-bottom)); right: 16px; max-width: calc(100vw - 32px); padding: 12px 16px; background: #124c3e; color: white; box-shadow: 0 5px 22px #132d2855; border-radius: 9px; font-size: 14px; }

@media (max-width: 1060px) {
  :root { --sidebar-width: 195px; }
  .sidebar { padding-inline: 12px; }
  .form-layout { gap: 16px; }
  .form-card { padding-inline: 18px; }
  .hero img { right: -23px; }
}

@media (max-width: 850px) {
  :root { --sidebar-width: 0px; }
  .sidebar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; position: static; width: auto; padding: 13px clamp(14px, 3vw, 24px) 0; border: 0; border-bottom: 1px solid var(--border); }
  .brand { margin: 0; }
  .navigation { grid-row: 2; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, max-content)); gap: 8px; }
  .navigation:has([data-admin-link]:not([hidden])) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-caption, .offline-status, .topbar { display: none; }
  .nav-link { border-radius: 8px 8px 0 0; }
  .nav-link[aria-current] { box-shadow: inset 0 -2px #16836b; }
  .sidebar-bottom { grid-row: 1; grid-column: 2; margin: 0; align-self: center; }
  .account-panel { margin-bottom: 3px; }
  .install { min-height: 40px; }
  .install > .icon { display: none; }
  .content { padding-top: 16px; }
}

@media (max-width: 640px) {
  .content { padding-inline: 14px; }
  .hero { min-height: 160px; padding: 19px 16px; border-radius: 12px; }
  .hero img { right: -64px; opacity: .42; }
  .hero-content { max-width: min(100%, 340px); }
  .hero p { max-width: 270px; font-size: 13px; }
  .form-layout { grid-template-columns: minmax(0, 1fr); margin-top: 14px; }
  .form-card, .archive-card { padding: 17px 14px; }
  .archive-card { margin-top: 14px; }
  .card-intro { margin-bottom: 17px; }
  .input-wrap input, .input-wrap select, .quantity-field input { font-size: 16px; }
  .field-row { gap: 9px; }
  .photo-picker { padding-inline: 6px; }
  .photo-label { min-height: 34px; }
  .remove-photo { top: 46px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .admin-panel, .metric { padding: 12px; }
  .metric-grid, .report-filters { gap: 8px; }
  .report-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-table { min-width: 600px; }
  .users-table { min-width: 485px; }
}

@media (max-width: 350px) {
  .install > span:nth-child(2) { font-size: 11px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand { gap: 6px; }
  .fields .field-row { grid-template-columns: 1fr; }
  .record { gap: 7px; }
  .metric-grid { grid-template-columns: 1fr; }
}

@page serah-terima { size: A4 landscape; margin: 12mm; }

@media print {
  :root:has(#report-sheet:not([hidden])) { page: serah-terima; background: white; color: black; }
  body:has(#report-sheet:not([hidden])) { min-width: 0; }
  body:has(#report-sheet:not([hidden])) :is(.sidebar, .topbar, .page-footer, .admin-hero, #admin-status, #report-filters, #print-report, .toast) { display: none !important; }
  body:has(#report-sheet:not([hidden])) .workspace { margin: 0; }
  body:has(#report-sheet:not([hidden])) .content { max-width: none; padding: 0; }
  #report-content { display: block; margin: 0; }
  #report-sheet { border: 0; border-radius: 0; box-shadow: none; padding: 0; }
  #report-sheet .report-heading { display: block; break-after: avoid; }
  .report-table-wrap { overflow: visible; }
  .report-table { min-width: 0; font-size: 9pt; }
  .report-table thead { display: table-header-group; }
  .report-table tr { break-inside: avoid; }
  .report-table th, .report-table td { padding: 5px 6px; border-bottom-color: #888; overflow-wrap: anywhere; }
}
