:root {
  --p-green-950: #032417;
  --p-green-900: #073f24;
  --p-green-800: #0d5c2f;
  --p-green-700: #16733e;
  --p-green-100: #eaf6ef;
  --p-gold: #f6c445;
  --p-ink: #15231b;
  --p-muted: #66746b;
  --p-line: #dfe8e2;
  --p-field-line: #7e9385;
  --p-surface: #fff;
  --p-canvas: #f3f7f4;
  --p-danger: #b42318;
  --p-shadow: 0 20px 60px rgba(3, 36, 23, .12);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--p-ink);
  background: var(--p-canvas);
  font-family: "Poppins", Arial, sans-serif;
}

button,
input,
textarea,
select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.pengurus-gate {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1rem;
  color: var(--p-muted);
}

.pengurus-gate img { width: 82px; height: 82px; object-fit: contain; }
.pengurus-gate i { color: var(--p-green-800); font-size: 1.3rem; }
.pengurus-gate p { margin: 0; font-size: .78rem; }

.pengurus-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.pengurus-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 280px;
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  color: #fff;
  background:
    radial-gradient(circle at top right, rgba(246, 196, 69, .15), transparent 13rem),
    linear-gradient(180deg, var(--p-green-950), #061c12);
  height: 100vh;
  overflow: hidden;
}

.pengurus-brand { flex: 0 0 auto; display: flex; align-items: center; gap: .75rem; padding-bottom: 1.2rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.pengurus-brand img { width: 46px; height: 46px; object-fit: contain; }
.pengurus-brand div { display: grid; line-height: 1.2; }
.pengurus-brand strong { font-size: .9rem; }
.pengurus-brand span { color: rgba(255,255,255,.58); font-size: .58rem; }
.pengurus-sidebar-close { display: none; margin-left: auto; border: 0; color: #fff; background: transparent; }

.pengurus-user { flex: 0 0 auto; display: flex; align-items: center; gap: .7rem; margin: 1.2rem 0; padding: .8rem; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.06); }
.pengurus-user-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: var(--p-green-950); background: var(--p-gold); }
.pengurus-user-avatar { flex: 0 0 auto; overflow: hidden; }
.pengurus-user-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.pengurus-user div { min-width: 0; display: grid; }
.pengurus-user strong { overflow: hidden; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.pengurus-user span { color: rgba(255,255,255,.58); font-size: .58rem; }

.pengurus-nav-caption { flex: 0 0 auto; margin: .4rem .55rem .6rem; color: rgba(255,255,255,.38); font-size: .56rem; font-weight: 800; letter-spacing: .14em; }
.pengurus-navigation { flex: 1 1 auto; min-height: 0; display: grid; align-content: start; gap: .35rem; padding-right: .35rem; overflow-x: hidden; overflow-y: auto; scrollbar-color: rgba(246,196,69,.55) rgba(255,255,255,.06); scrollbar-width: thin; }
.pengurus-navigation::-webkit-scrollbar { width: 6px; }
.pengurus-navigation::-webkit-scrollbar-track { background: rgba(255,255,255,.06); }
.pengurus-navigation::-webkit-scrollbar-thumb { background: rgba(246,196,69,.55); }
.pengurus-nav-button {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: 28px 1fr 16px;
  align-items: center;
  gap: .5rem;
  padding: 0 .7rem;
  border: 1px solid transparent;
  color: rgba(255,255,255,.72);
  background: transparent;
  text-align: left;
  font-size: .68rem;
  font-weight: 700;
}
.pengurus-nav-button i:first-child { color: var(--p-gold); }
.pengurus-nav-button i:last-child { font-size: .55rem; opacity: .55; }
.pengurus-nav-button:hover,
.pengurus-nav-button.active { border-color: rgba(246,196,69,.22); color: #fff; background: rgba(255,255,255,.09); }

.pengurus-sidebar-actions { flex: 0 0 auto; margin-top: auto; display: grid; gap: .45rem; padding-top: 1.4rem; }
.pengurus-sidebar-actions button,
.pengurus-sidebar-actions a { min-height: 42px; display: flex; align-items: center; justify-content: center; gap: .5rem; border: 1px solid rgba(255,255,255,.13); color: rgba(255,255,255,.75); background: rgba(255,255,255,.05); font-size: .66rem; font-weight: 700; }
.pengurus-sidebar-actions a[hidden] { display: none !important; }
.pengurus-logout { color: #ffd0cc !important; }

.pengurus-main { grid-column: 2; min-width: 0; }
.pengurus-header { position: sticky; top: 0; z-index: 25; min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 3vw, 2.5rem); border-bottom: 1px solid var(--p-line); background: rgba(255,255,255,.93); backdrop-filter: blur(15px); }
.pengurus-header-title { display: flex; align-items: center; gap: .8rem; }
.pengurus-header-title div { display: grid; }
.pengurus-header-title span { color: var(--p-muted); font-size: .62rem; }
.pengurus-header h1 { margin: 0; font-size: clamp(1.15rem, 2vw, 1.65rem); }
.pengurus-menu-button { display: none; width: 40px; height: 40px; border: 1px solid var(--p-line); color: var(--p-green-800); background: var(--p-surface); }
.pengurus-header-date { display: inline-flex; align-items: center; gap: .5rem; color: var(--p-muted); font-size: .68rem; }
.pengurus-header-date i { color: var(--p-green-800); }

.pengurus-content { min-width: 0; display: grid; gap: 1.25rem; padding: clamp(1rem, 3vw, 2.5rem); }
.pengurus-content > * { min-width: 0; }
.pengurus-welcome { position: relative; min-height: 285px; display: grid; align-items: center; overflow: hidden; padding: clamp(1.4rem, 4vw, 3rem); color: #fff; background: linear-gradient(105deg, rgba(3,36,23,.98), rgba(13,92,47,.84)), var(--pengurus-image) center/cover; box-shadow: var(--p-shadow); }
.pengurus-welcome::after { content: ""; position: absolute; width: 300px; height: 300px; right: -100px; top: -120px; border: 1px solid rgba(246,196,69,.25); border-radius: 50%; }
.pengurus-welcome > div { position: relative; z-index: 1; max-width: 790px; }
.pengurus-welcome > div > span { color: var(--p-gold); font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.pengurus-welcome h2 { max-width: 760px; margin: .7rem 0; font-size: clamp(1.55rem, 3.5vw, 2.7rem); line-height: 1.15; }
.pengurus-welcome p { max-width: 760px; margin: .35rem 0; color: rgba(255,255,255,.76); font-size: .78rem; line-height: 1.8; }
.pengurus-general-info { font-size: .68rem !important; }
.pengurus-general-file { margin-top: .8rem; display: inline-flex; align-items: center; gap: .45rem; padding: .7rem .85rem; border: 1px solid rgba(255,255,255,.2); color: #fff; background: rgba(255,255,255,.1); font-size: .66rem; font-weight: 800; }

.pengurus-module-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding-top: .4rem; }
.pengurus-module-head > div > span { color: var(--p-green-800); font-size: .62rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.pengurus-module-head h2 { margin: .25rem 0; font-size: clamp(1.35rem, 2.8vw, 2rem); }
.pengurus-module-head p { margin: 0; color: var(--p-muted); font-size: .74rem; }

.pengurus-primary-button,
.pengurus-secondary-button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: 0 .9rem; border: 1px solid var(--p-green-800); font-size: .68rem; font-weight: 800; }
.pengurus-primary-button { color: #fff; background: var(--p-green-800); }
.pengurus-primary-button:hover { background: var(--p-green-700); }
.pengurus-secondary-button { color: var(--p-green-800); background: var(--p-surface); }
.pengurus-primary-button:disabled,
.pengurus-secondary-button:disabled { opacity: .58; cursor: wait; }

.inventory-summary { display: grid; gap: .8rem; }
.inventory-summary-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.inventory-summary-cards article { min-width: 0; min-height: 108px; display: flex; align-items: center; gap: .8rem; padding: 1rem; border: 1px solid var(--p-line); border-left: 4px solid var(--p-green-800); background: var(--p-surface); box-shadow: 0 8px 28px rgba(3,36,23,.05); }
.inventory-summary-cards article:nth-child(3) { border-left-color: #ce7b12; }
.inventory-summary-cards article:nth-child(4) { border-left-color: var(--p-danger); }
.inventory-summary-cards article:nth-child(5) { border-left-color: #2477b3; }
.inventory-summary-cards article:nth-child(6) { border-left-color: var(--p-gold); }
.inventory-summary-cards article.inventory-summary-value { grid-column: span 2; border-left-color: #4b5fb5; }
.inventory-summary-icon { flex: 0 0 auto; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; color: var(--p-green-800); background: var(--p-green-100); }
.inventory-summary-cards article > div { min-width: 0; display: grid; gap: .2rem; }
.inventory-summary-cards article > div span { color: var(--p-muted); font-size: .61rem; }
.inventory-summary-cards strong { overflow: hidden; color: var(--p-ink); font-size: clamp(1rem, 2vw, 1.38rem); text-overflow: ellipsis; }
.inventory-low-stock-alert { min-height: 48px; display: flex; align-items: center; gap: .65rem; padding: .65rem .8rem; border: 1px solid rgba(206,123,18,.38); color: var(--p-ink); background: color-mix(in srgb, var(--p-gold) 15%, var(--p-surface)); font-size: .68rem; }
.inventory-low-stock-alert i { color: #ce7b12; }
.inventory-low-stock-alert button { margin-left: auto; min-height: 32px; padding: 0 .65rem; border: 1px solid #ce7b12; color: var(--p-ink); background: var(--p-surface); font-size: .61rem; font-weight: 800; }

.pengurus-toolbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: .75rem; padding: .9rem; border: 1px solid var(--p-line); background: var(--p-surface); }
.pengurus-toolbar .pengurus-search { grid-column: span 2; }
.pengurus-search { display: flex; align-items: center; gap: .6rem; min-height: 42px; padding: 0 .8rem; border: 1px solid var(--p-line); background: var(--p-canvas); }
.pengurus-search i { color: var(--p-green-800); }
.pengurus-search input { width: 100%; border: 0; outline: 0; color: var(--p-ink); background: transparent; font-size: .7rem; }
.pengurus-filter { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .55rem; padding: 0 .75rem; border: 1px solid var(--p-line); }
.pengurus-filter span { color: var(--p-muted); font-size: .62rem; }
.pengurus-filter select,
.pengurus-filter input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--p-ink); background: transparent; font-size: .68rem; }
.pengurus-date-filter { min-height: 42px; }

.inventory-report-toolbar { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: .8rem; padding: .9rem; border: 1px solid var(--p-line); background: var(--p-surface); }
.inventory-report-toolbar > label { min-width: min(310px, 100%); display: grid; gap: .4rem; color: var(--p-muted); font-size: .62rem; }
.inventory-report-toolbar select { width: 100%; min-height: 42px; padding: 0 .75rem; border: 1px solid var(--p-line); color: var(--p-ink); background: var(--p-canvas); font-size: .68rem; }
.inventory-report-actions { display: flex; flex-wrap: wrap; gap: .55rem; }

.pengurus-data-card { min-width: 0; max-width: 100%; border: 1px solid var(--p-line); background: var(--p-surface); box-shadow: 0 10px 35px rgba(3,36,23,.06); }
.pengurus-data-summary { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; border-bottom: 1px solid var(--p-line); }
.pengurus-data-summary > div { display: flex; align-items: baseline; gap: .4rem; }
.pengurus-data-summary strong { color: var(--p-green-800); font-size: 1.35rem; }
.pengurus-data-summary span { color: var(--p-muted); font-size: .64rem; }
.pengurus-table-wrap { width: 100%; min-width: 0; max-width: 100%; overflow-x: auto; }
.pengurus-table { width: 100%; min-width: 800px; border-collapse: collapse; }
.pengurus-table th { padding: .85rem 1rem; color: var(--p-muted); background: var(--p-canvas); text-align: left; font-size: .59rem; letter-spacing: .04em; text-transform: uppercase; }
.pengurus-table td { padding: .9rem 1rem; border-top: 1px solid var(--p-line); font-size: .67rem; vertical-align: middle; }
.pengurus-table td:first-child { font-weight: 700; }
.pengurus-table tr.is-low-stock td { background: color-mix(in srgb, var(--p-gold) 8%, var(--p-surface)); }
.pengurus-table-actions { display: flex; gap: .4rem; }
.pengurus-table-actions button { width: 34px; height: 34px; border: 1px solid var(--p-line); color: var(--p-green-800); background: var(--p-surface); }
.pengurus-table-actions .delete { color: var(--p-danger); }
.pengurus-table-actions .return { color: #2477b3; }
.pengurus-table-actions .late { color: #ce7b12; }
.pengurus-photo-button { min-height: 34px; display: inline-flex; align-items: center; gap: .35rem; padding: 0 .65rem; border: 1px solid rgba(13,92,47,.22); border-radius: 6px; color: var(--p-green-800); background: var(--p-green-100); font-size: .61rem; font-weight: 800; white-space: nowrap; }
.pengurus-no-photo { color: var(--p-muted); font-size: .6rem; white-space: nowrap; }
.pengurus-status { display: inline-flex; padding: .35rem .55rem; border-radius: 999px; color: var(--p-green-800); background: var(--p-green-100); font-size: .59rem; font-weight: 800; }
.pengurus-empty { min-height: 280px; display: grid; place-content: center; justify-items: center; gap: .55rem; color: var(--p-muted); }
.pengurus-empty i { color: var(--p-green-800); font-size: 2rem; }
.pengurus-empty strong { color: var(--p-ink); font-size: .8rem; }
.pengurus-empty span { font-size: .67rem; }

.data-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem; padding: 1rem; border-top: 1px solid var(--p-line); }
.data-pagination button { min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: 0 .65rem; border: 1px solid var(--p-line); border-radius: 7px; color: var(--p-ink); background: var(--p-surface); font-size: .66rem; font-weight: 800; }
.data-pagination button.active { border-color: var(--p-green-800); color: #fff; background: var(--p-green-800); }
.data-pagination button:disabled { opacity: .4; cursor: not-allowed; }

.finance-summary { display: grid; gap: 1rem; }
.finance-summary-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
.finance-summary-cards article { display: grid; gap: .35rem; min-height: 105px; align-content: center; padding: 1rem; border: 1px solid var(--p-line); border-left: 4px solid var(--p-green-800); background: var(--p-surface); box-shadow: 0 8px 28px rgba(3,36,23,.05); }
.finance-summary-cards article:nth-child(2) { border-left-color: var(--p-danger); }
.finance-summary-cards article:nth-child(3) { border-left-color: var(--p-gold); }
.finance-summary-cards article:nth-child(4) { border-left-color: #258bd2; }
.finance-summary-cards span { color: var(--p-muted); font-size: .64rem; }
.finance-summary-cards strong { color: var(--p-ink); font-size: clamp(.95rem, 2vw, 1.35rem); }
.finance-period-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.finance-period-grid > article { min-width: 0; padding: 1rem; border: 1px solid var(--p-line); background: var(--p-surface); }
.finance-period-grid h3 { margin: 0 0 .8rem; color: var(--p-ink); font-size: .8rem; }
.finance-period-row { display: grid; grid-template-columns: minmax(120px, 1fr) repeat(3, auto); align-items: center; gap: .65rem; padding: .6rem 0; border-top: 1px solid var(--p-line); font-size: .6rem; }
.finance-period-row strong { color: var(--p-ink); }
.finance-period-row .income { color: var(--p-green-700); }
.finance-period-row .expense { color: var(--p-danger); }
.finance-period-row b { color: var(--p-ink); }
.finance-no-data { margin: 0; color: var(--p-muted); font-size: .65rem; }

.record-form-section { grid-column: 1 / -1; margin: .5rem 0 -.1rem; padding: .78rem 0 .48rem; border-bottom: 1px solid var(--p-line); color: var(--p-green-800); font-size: .78rem; }
.record-field { display: grid; align-content: start; gap: .45rem; }
.record-field.is-wide { grid-column: 1 / -1; }
.record-field > span { color: var(--p-ink); font-size: .78rem; font-weight: 700; line-height: 1.4; }
.record-field > span small { color: var(--p-danger); }
.record-field input,
.record-field textarea,
.record-field select { width: 100%; min-height: 46px; padding: .72rem .82rem; border: 1px solid var(--p-field-line); border-radius: 7px; outline: 0; color: var(--p-ink); background: var(--p-canvas); font-size: .78rem; line-height: 1.45; }
.record-field textarea { min-height: 120px; resize: vertical; }
.record-field input:focus,
.record-field textarea:focus,
.record-field select:focus { border-color: var(--p-green-700); box-shadow: 0 0 0 3px color-mix(in srgb, var(--p-green-700) 22%, transparent); }
.record-field input:focus-visible,
.record-field textarea:focus-visible,
.record-field select:focus-visible,
.import-dialog button:focus-visible,
.import-dialog input:focus-visible { outline: 2px solid var(--p-gold); outline-offset: 2px; }
.record-field input::placeholder,
.record-field textarea::placeholder { color: var(--p-muted); opacity: 1; }
.record-field input[readonly],
.record-field select:disabled { color: var(--p-muted); background: color-mix(in srgb, var(--p-canvas) 78%, var(--p-line)); cursor: not-allowed; }
.record-field-help { color: var(--p-muted); font-size: .68rem; line-height: 1.55; }
.record-upload { display: grid; gap: .55rem; padding: .8rem; border: 1px solid var(--p-line); background: var(--p-canvas); }
.record-upload-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.record-upload-row input[type="text"] { flex: 1 1 260px; }
.record-upload-button,
.record-upload-edit,
.record-upload-preview,
.record-upload-clear,
.record-upload-open { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: 0 .7rem; border: 1px solid var(--p-line); color: var(--p-green-800); background: var(--p-surface); font-size: .63rem; font-weight: 800; }
.record-upload-button input { display: none; }
.record-upload-edit { border-color: var(--p-green-800); }
.record-upload-edit:disabled { opacity: .55; cursor: wait; }
.record-upload-edit[hidden] { display: none; }
.record-upload-preview[hidden],
.record-upload-open[hidden] { display: none; }
.record-upload-clear { color: var(--p-danger); }
.record-upload small { color: var(--p-muted); font-size: .6rem; }
.record-field > span .upload-requirement { margin-left: .35rem; padding: .16rem .35rem; border-radius: 999px; color: var(--p-danger); background: color-mix(in srgb, var(--p-danger) 9%, var(--p-surface)); font-size: .54rem; font-weight: 800; }
.record-upload-multiple { gap: .75rem; }
.record-upload-button.is-loading { opacity: .6; pointer-events: none; }
.record-upload-list { display: grid; gap: .5rem; }
.record-upload-list article { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .65rem; border: 1px solid var(--p-line); background: var(--p-surface); }
.record-upload-list article > div:first-child { min-width: 0; display: flex; align-items: center; gap: .6rem; }
.record-upload-list article > div:first-child > i { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; color: var(--p-green-800); background: var(--p-green-100); }
.record-upload-list article span { min-width: 0; display: grid; gap: .12rem; }
.record-upload-list article strong { overflow: hidden; color: var(--p-ink); font-size: .62rem; text-overflow: ellipsis; white-space: nowrap; }
.record-upload-list article small { color: var(--p-muted); font-size: .54rem; }
.record-upload-list-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; }
.record-upload-list-actions button { min-height: 33px; display: inline-flex; align-items: center; gap: .3rem; padding: 0 .5rem; border: 1px solid var(--p-line); color: var(--p-green-800); background: var(--p-surface); font-size: .57rem; font-weight: 800; }
.record-upload-list-actions button.remove { color: var(--p-danger); }
.record-upload-empty { margin: 0; padding: .75rem; border: 1px dashed var(--p-line); color: var(--p-muted); background: var(--p-surface); font-size: .61rem; text-align: center; }
.photo-dialog { width: min(920px, calc(100% - 2rem)); max-width: none; padding: 0; border: 0; border-radius: 14px; color: var(--p-ink); background: var(--p-surface); box-shadow: 0 30px 100px rgba(0,0,0,.38); }
.photo-dialog::backdrop { background: rgba(1,14,8,.75); backdrop-filter: blur(6px); }
.photo-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--p-line); }
.photo-dialog header span { color: var(--p-green-800); font-size: .6rem; font-weight: 800; text-transform: uppercase; }
.photo-dialog h2 { margin: .1rem 0 0; font-size: 1.15rem; }
.photo-dialog header button { width: 38px; height: 38px; border: 1px solid var(--p-line); border-radius: 50%; color: var(--p-ink); background: var(--p-surface); }
.photo-dialog-body { min-height: 260px; max-height: 75vh; padding: 1rem; overflow-y: auto; background: var(--p-canvas); }
.inventory-photo-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.inventory-photo-gallery figure { min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--p-line); border-radius: 10px; background: var(--p-surface); }
.inventory-photo-gallery img { width: 100%; aspect-ratio: 4 / 3; display: block; object-fit: cover; }
.inventory-photo-gallery figcaption { padding: .65rem .75rem; color: var(--p-ink); font-size: .64rem; font-weight: 800; }
.inventory-photo-loading,
.inventory-photo-empty { grid-column: 1 / -1; min-height: 220px; display: grid; place-content: center; justify-items: center; gap: .5rem; margin: 0; color: var(--p-muted); font-size: .68rem; }

.detail-dialog,
.import-dialog,
.return-dialog { width: min(880px, calc(100% - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; overflow: hidden; border: 1px solid var(--p-field-line); border-radius: 14px; color: var(--p-ink); background: var(--p-surface); box-shadow: 0 30px 100px rgba(0,0,0,.38); }
.detail-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.import-dialog[open] form,
.return-dialog[open] form { max-height: calc(100dvh - 2rem); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.detail-dialog::backdrop,
.import-dialog::backdrop,
.return-dialog::backdrop { background: rgba(1,14,8,.75); backdrop-filter: blur(6px); }
.detail-dialog > header,
.import-dialog form > header,
.return-dialog form > header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--p-line); background: var(--p-surface); }
.detail-dialog header div,
.import-dialog header div,
.return-dialog header div { display: grid; }
.detail-dialog header span,
.import-dialog header span,
.return-dialog header span { color: var(--p-green-800); font-size: .6rem; font-weight: 800; text-transform: uppercase; }
.detail-dialog h2,
.import-dialog h2,
.return-dialog h2 { margin: .1rem 0 0; font-size: 1.2rem; }
.detail-dialog header button,
.import-dialog header button,
.return-dialog header button { width: 38px; height: 38px; border: 1px solid var(--p-line); border-radius: 50%; color: var(--p-ink); background: var(--p-surface); }
.detail-dialog-body,
.import-dialog-body,
.return-dialog-body { min-height: 0; display: grid; gap: 1rem; padding: 1.2rem; overflow-x: hidden; overflow-y: auto; }
.detail-dialog-body section { display: grid; gap: .7rem; }
.detail-dialog-body h3,
.import-preview h3 { margin: 0; padding-bottom: .5rem; border-bottom: 1px solid var(--p-line); color: var(--p-green-800); font-size: .76rem; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.detail-item { min-width: 0; display: grid; gap: .25rem; padding: .7rem; border: 1px solid var(--p-line); background: var(--p-canvas); }
.detail-item.is-wide { grid-column: 1 / -1; }
.detail-item span { color: var(--p-muted); font-size: .58rem; }
.detail-item strong { overflow-wrap: anywhere; color: var(--p-ink); font-size: .68rem; white-space: pre-wrap; }
.detail-file-button { width: fit-content; min-height: 36px; display: inline-flex; align-items: center; gap: .4rem; padding: 0 .7rem; border: 1px solid var(--p-green-800); color: var(--p-green-800); background: var(--p-surface); font-size: .62rem; font-weight: 800; }
.detail-file-list { display: grid; gap: .5rem; }
.detail-file-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .5rem; border: 1px solid var(--p-line); background: var(--p-surface); }
.detail-file-actions small { flex: 1 1 180px; overflow-wrap: anywhere; color: var(--p-muted); font-size: .57rem; }
.detail-dialog > footer,
.import-dialog form > footer,
.return-dialog form > footer { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: .65rem; padding: 1rem 1.2rem; border-top: 1px solid var(--p-line); background: var(--p-surface); }
.import-dialog-body > p,
.return-dialog-body > p { margin: 0; color: var(--p-muted); font-size: .74rem; line-height: 1.7; }
.import-dialog-body { min-height: 0; overflow-x: hidden; overflow-y: auto; scrollbar-color: var(--p-green-700) var(--p-canvas); scrollbar-width: thin; }
.import-file-field { display: grid; gap: .55rem; color: var(--p-ink); font-size: .78rem; font-weight: 700; }
.import-file-field input { width: 100%; padding: .45rem; border: 1px dashed var(--p-green-700); border-radius: 8px; color: var(--p-ink); background: var(--p-canvas); font-size: .76rem; }
.import-file-field input::file-selector-button { min-height: 36px; margin-right: .7rem; padding: 0 .75rem; border: 1px solid var(--p-green-800); border-radius: 6px; color: #fff; background: var(--p-green-800); font: inherit; font-weight: 800; cursor: pointer; }
.import-file-field small { display: flex; align-items: center; gap: .45rem; min-height: 40px; padding: .6rem .7rem; border: 1px solid var(--p-line); border-radius: 7px; color: var(--p-muted); background: var(--p-canvas); font-size: .7rem; font-weight: 600; }
.import-file-field small.has-file { border-color: var(--p-green-700); color: var(--p-ink); }
.import-file-field small i { color: var(--p-green-700); }
.import-update-field { display: flex; align-items: center; gap: .6rem; min-height: 44px; padding: .65rem .7rem; border: 1px solid var(--p-line); border-radius: 7px; color: var(--p-ink); background: var(--p-canvas); font-size: .75rem; }
.import-update-field input { flex: 0 0 auto; width: 18px; height: 18px; accent-color: var(--p-green-700); }
.import-preview { min-width: 0; display: grid; gap: .7rem; }
.import-preview > div:first-child { display: flex; align-items: end; justify-content: space-between; gap: .8rem; }
.import-preview > div:first-child span { color: var(--p-muted); font-size: .6rem; }
.import-preview-table { max-width: 100%; overflow-x: auto; }
.import-preview table { width: 100%; min-width: 680px; border-collapse: collapse; }
.import-preview th,
.import-preview td { padding: .6rem; border: 1px solid var(--p-line); text-align: left; font-size: .6rem; }
.import-preview th { color: var(--p-muted); background: var(--p-canvas); }
.return-dialog-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.return-dialog-body > p,
.return-dialog-body .is-wide { grid-column: 1 / -1; }

.pengurus-toast { position: fixed; z-index: 100; right: 1.2rem; bottom: 1.2rem; max-width: min(390px, calc(100% - 2.4rem)); padding: .9rem 1rem; color: #fff; background: var(--p-green-900); box-shadow: var(--p-shadow); font-size: .7rem; opacity: 0; transform: translateY(20px); pointer-events: none; transition: .25s ease; }
.pengurus-toast.show { opacity: 1; transform: translateY(0); }
.pengurus-toast.error { background: var(--p-danger); }
.pengurus-sidebar-overlay { display: none; }

.pengurus-medical-workspace { min-width: 0; }
.pengurus-medical-workspace .medinv,
.pengurus-page .medinv-dialog {
  --admin-bg: var(--p-canvas);
  --admin-surface: var(--p-surface);
  --admin-card: var(--p-surface);
  --admin-text: var(--p-ink);
  --admin-text-muted: var(--p-muted);
  --admin-border: var(--p-line);
  --admin-field-border: var(--p-field-line);
  --admin-primary: var(--p-green-800);
  --admin-primary-text: #ffffff;
  --admin-accent: var(--p-gold);
  --admin-danger: var(--p-danger);
  --admin-input-bg: var(--p-canvas);
  --admin-input-text: var(--p-ink);
}

[data-theme="dark"] {
  --p-ink: #eef8f1;
  --p-muted: #aebbb3;
  --p-line: rgba(255,255,255,.12);
  --p-field-line: #52705d;
  --p-surface: #102619;
  --p-canvas: #07170f;
  --p-shadow: 0 20px 60px rgba(0,0,0,.3);
}
[data-theme="dark"] .pengurus-header { background: rgba(10,30,19,.93); }
[data-theme="dark"] .pengurus-search input::placeholder { color: #75837a; }
[data-theme="dark"] .pengurus-status { color: #9ee5b7; background: rgba(22,115,62,.24); }
[data-theme="dark"] .pengurus-photo-button { border-color: rgba(114,214,150,.25); color: #9ee5b7; background: rgba(22,115,62,.24); }
[data-theme="dark"] .inventory-summary-icon { color: #9ee5b7; background: rgba(22,115,62,.24); }
[data-theme="dark"] .pengurus-module-head > div > span,
[data-theme="dark"] .record-form-section,
[data-theme="dark"] .detail-dialog-body h3,
[data-theme="dark"] .import-preview h3,
[data-theme="dark"] .detail-dialog header span,
[data-theme="dark"] .import-dialog header span,
[data-theme="dark"] .return-dialog header span { color: #9ee5b7; }
[data-theme="dark"] .pengurus-secondary-button,
[data-theme="dark"] .record-upload-button,
[data-theme="dark"] .record-upload-edit,
[data-theme="dark"] .record-upload-preview,
[data-theme="dark"] .record-upload-open,
[data-theme="dark"] .record-upload-list-actions button:not(.remove),
[data-theme="dark"] .detail-file-button,
[data-theme="dark"] .pengurus-table-actions button:not(.delete):not(.late) { border-color: rgba(114,214,150,.32); color: #9ee5b7; }
[data-theme="dark"] .record-upload-clear,
[data-theme="dark"] .pengurus-table-actions .delete { border-color: rgba(255,159,153,.3); color: #ff9f99; }
[data-theme="dark"] .import-dialog input,
[data-theme="dark"] .return-dialog input,
[data-theme="dark"] .return-dialog select,
[data-theme="dark"] .return-dialog textarea { color-scheme: dark; }
[data-theme="light"] .import-dialog input,
[data-theme="light"] .return-dialog input,
[data-theme="light"] .return-dialog select,
[data-theme="light"] .return-dialog textarea { color-scheme: light; }

@media (max-width: 1050px) {
  .pengurus-app { grid-template-columns: 1fr; }
  .pengurus-main { grid-column: 1; }
  .pengurus-sidebar { transform: translateX(-105%); transition: transform .25s ease; }
  .pengurus-sidebar.open { transform: translateX(0); }
  .pengurus-sidebar-close,
  .pengurus-menu-button { display: grid; place-items: center; }
  .pengurus-sidebar-overlay { position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.5); }
  .pengurus-sidebar-overlay.show { display: block; }
  .finance-summary-cards,
  .inventory-summary-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .pengurus-header-date { display: none; }
  .pengurus-toolbar { grid-template-columns: 1fr; }
  .pengurus-toolbar .pengurus-search { grid-column: auto; }
  .pengurus-filter { min-height: 42px; }
  .pengurus-module-head { align-items: stretch; flex-direction: column; }
  .pengurus-primary-button { align-self: flex-start; }
  .finance-summary-cards,
  .finance-period-grid { grid-template-columns: 1fr; }
  .inventory-report-toolbar { align-items: stretch; flex-direction: column; }
  .inventory-report-actions > button { flex: 1 1 150px; }
  .detail-grid,
  .return-dialog-body { grid-template-columns: 1fr; }
  .record-upload-list article { align-items: stretch; flex-direction: column; }
  .record-upload-list-actions { justify-content: flex-start; }
  .detail-item.is-wide,
  .return-dialog-body > p,
  .return-dialog-body .is-wide { grid-column: auto; }
  .finance-period-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .pengurus-content { padding: .8rem; }
  .pengurus-header { padding: .75rem .8rem; }
  .pengurus-header-title span { display: none; }
  .pengurus-welcome { min-height: 320px; }
  .pengurus-data-summary { align-items: flex-start; flex-direction: column; }
  .import-dialog[open] form,
  .return-dialog[open] form { min-height: 100%; max-height: 100dvh; }
  .detail-dialog,
  .import-dialog,
  .return-dialog { width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  .import-dialog form > footer,
  .return-dialog form > footer { flex-wrap: wrap; }
  .import-dialog form > footer button,
  .return-dialog form > footer button { flex: 1 1 145px; }
  .inventory-summary-cards { grid-template-columns: 1fr; }
  .inventory-summary-cards article.inventory-summary-value { grid-column: auto; }
  .inventory-low-stock-alert { align-items: flex-start; flex-wrap: wrap; }
  .inventory-low-stock-alert button { margin-left: 0; }
  .inventory-report-actions { display: grid; grid-template-columns: 1fr; }
  .pengurus-theme-toggle span { display: inline; }
  .inventory-photo-gallery { grid-template-columns: 1fr; }
}
