:root {
  --navy-900: #0a2540;
  --navy-800: #0f3157;
  --navy-700: #163e6b;
  --cream-100: #fbf6e9;
  --cream-200: #f4e9c9;
  --cream-300: #ecdba0;
  --white: #ffffff;
  --ink: #1c2b3a;
  --muted: #5c6b7a;
  --danger: #a8324a;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(10, 37, 64, 0.08);
  --font-display: "Fraunces", "Georgia", serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream-100);
  color: var(--ink);
  font-family: var(--font-body);
  scroll-behavior: smooth;
}

a { color: inherit; }

/* ===== Layout ===== */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  background: linear-gradient(180deg, var(--navy-900), var(--navy-800));
  color: var(--cream-100);
  padding: 28px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(244, 233, 201, 0.2);
  margin-bottom: 18px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--cream-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy-900);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
}

.brand-text .eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cream-300);
  margin: 0 0 2px;
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.25;
  margin: 0;
  font-weight: 600;
}

nav.menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

nav.menu button {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--cream-100);
  opacity: 0.78;
  transition: background 0.15s, opacity 0.15s;
}

nav.menu button .num {
  font-family: var(--font-display);
  font-size: 12px;
  width: 20px;
  color: var(--cream-300);
  opacity: 0.8;
}

nav.menu button:hover {
  background: rgba(244, 233, 201, 0.08);
  opacity: 1;
}

nav.menu button.active {
  background: var(--cream-200);
  color: var(--navy-900);
  opacity: 1;
  font-weight: 600;
}

nav.menu button.active .num { color: var(--navy-800); }

.sidebar-foot {
  font-size: 11px;
  color: var(--cream-300);
  opacity: 0.7;
  border-top: 1px solid rgba(244, 233, 201, 0.2);
  padding-top: 14px;
  margin-top: 14px;
  line-height: 1.5;
}

/* ===== Main content ===== */
main {
  padding: 36px 44px 60px;
  max-width: 1180px;
}

.page-head {
  margin-bottom: 26px;
}

.page-head .eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--navy-700);
  font-weight: 600;
  margin: 0 0 6px;
}

.page-head h2 {
  font-family: var(--font-display);
  font-size: 30px;
  margin: 0 0 8px;
  color: var(--navy-900);
}

.page-head p {
  color: var(--muted);
  margin: 0;
  max-width: 640px;
  line-height: 1.55;
}

/* ===== Cards / panels ===== */
.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--cream-300);
}

.panel + .panel { margin-top: 22px; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--cream-200);
}

.panel-head h3 {
  font-family: var(--font-display);
  font-size: 17px;
  margin: 0;
  color: var(--navy-900);
}

.panel-body { padding: 20px; }

/* ===== Buttons ===== */
.btn {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  transition: transform 0.1s, box-shadow 0.15s;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--navy-900);
  color: var(--cream-100);
}
.btn-primary:hover { background: var(--navy-700); }

.btn-ghost {
  background: var(--cream-200);
  color: var(--navy-900);
}
.btn-ghost:hover { background: var(--cream-300); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  padding: 6px 10px;
  font-size: 12.5px;
}
.btn-danger:hover { background: #f7e6ea; }

.btn-small { padding: 6px 12px; font-size: 12.5px; }

/* ===== Table (spreadsheet-style: OBAT & BAHAN) ===== */
.table-wrap { overflow-x: auto; }

table.sheet {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.sheet th {
  text-align: left;
  background: var(--cream-200);
  color: var(--navy-900);
  padding: 10px 12px;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid var(--cream-300);
}

table.sheet td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--cream-200);
  vertical-align: top;
}

table.sheet tbody tr:hover { background: #fffdf6; }

.stok-low { color: var(--danger); font-weight: 700; }

.actions-col { white-space: nowrap; text-align: right; }

/* ===== Forms ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.form-grid.cols-1 { grid-template-columns: 1fr; }

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--navy-800);
  margin-bottom: 5px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 7px;
  border: 1px solid var(--cream-300);
  background: var(--cream-100);
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--ink);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--navy-700);
  outline-offset: 1px;
  background: var(--white);
}

.field textarea { resize: vertical; min-height: 64px; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* ===== Cards grid (PERALATAN MEDIS) ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.item-card {
  background: var(--white);
  border: 1px solid var(--cream-300);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.item-card .thumb {
  aspect-ratio: 4/3;
  background: var(--cream-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--navy-700);
  font-size: 12px;
  overflow: hidden;
}

.item-card .thumb img { width: 100%; height: 100%; object-fit: cover; }

.item-card .info { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 4px; }

.item-card .info h4 {
  font-family: var(--font-display);
  font-size: 15px;
  margin: 0;
  color: var(--navy-900);
}

.item-card .info .qty { font-size: 12px; color: var(--muted); }

.item-card .info p { font-size: 12.8px; color: var(--muted); margin: 4px 0 0; line-height: 1.4; }

.item-card .info-foot {
  display: flex;
  justify-content: flex-end;
  padding: 8px 10px 10px;
}

/* ===== Agenda timeline ===== */
.timeline { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 18px;
  padding: 18px 0;
  border-bottom: 1px solid var(--cream-200);
}
.timeline-item:last-child { border-bottom: none; }

.date-badge {
  background: var(--navy-900);
  color: var(--cream-100);
  border-radius: 8px;
  text-align: center;
  padding: 10px 6px;
  height: fit-content;
}
.date-badge .d { font-family: var(--font-display); font-size: 22px; line-height: 1; display: block; }
.date-badge .m { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cream-300); }

.timeline-body h4 { margin: 0 0 4px; font-family: var(--font-display); color: var(--navy-900); font-size: 16px; }
.timeline-body p { margin: 0 0 10px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.timeline-body img { max-width: 260px; border-radius: 8px; border: 1px solid var(--cream-300); display: block; }
.timeline-foot { display: flex; justify-content: flex-end; margin-top: 8px; }

/* ===== Documents list ===== */
.doc-list { display: flex; flex-direction: column; gap: 10px; }
.doc-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--cream-300);
  border-radius: 8px;
  background: var(--cream-100);
}
.doc-icon {
  width: 38px; height: 38px; border-radius: 8px;
  background: var(--navy-900); color: var(--cream-100);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.doc-meta { flex: 1; min-width: 0; }
.doc-meta .name { font-weight: 600; color: var(--navy-900); font-size: 14px; }
.doc-meta .sub { font-size: 12px; color: var(--muted); }

/* ===== About page ===== */
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 22px;
}
.about-hero {
  background: var(--navy-900);
  color: var(--cream-100);
  border-radius: var(--radius);
  padding: 30px 28px;
  position: relative;
  overflow: hidden;
}
.about-hero::after {
  content: "+";
  position: absolute;
  right: -10px;
  bottom: -40px;
  font-family: var(--font-display);
  font-size: 220px;
  color: rgba(244, 233, 201, 0.06);
  line-height: 1;
}
.about-hero .eyebrow { color: var(--cream-300); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; margin: 0 0 10px; }
.about-hero h3 { font-family: var(--font-display); font-size: 24px; margin: 0 0 12px; }
.about-hero p { color: var(--cream-200); line-height: 1.6; font-size: 14px; margin: 0; }

.info-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.info-list li { display: flex; flex-direction: column; gap: 2px; padding-bottom: 12px; border-bottom: 1px solid var(--cream-200); }
.info-list .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--navy-700); font-weight: 700; }
.info-list .v { font-size: 14px; color: var(--ink); }

/* ===== Empty state ===== */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 13.5px;
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 37, 64, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%; max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(10,37,64,0.25);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 22px; border-bottom: 1px solid var(--cream-200);
}
.modal-head h3 { font-family: var(--font-display); margin: 0; color: var(--navy-900); font-size: 17px; }
.modal-close { all: unset; cursor: pointer; color: var(--muted); font-size: 20px; padding: 2px 6px; }
.modal-body { padding: 20px 22px; }
.hidden { display: none !important; }

/* ===== Toast ===== */
#toast {
  position: fixed; bottom: 22px; right: 22px;
  background: var(--navy-900); color: var(--cream-100);
  padding: 12px 18px; border-radius: 8px; font-size: 13.5px;
  box-shadow: var(--shadow); z-index: 100;
  transform: translateY(20px); opacity: 0; pointer-events: none;
  transition: all 0.25s;
}
#toast.show { transform: translateY(0); opacity: 1; }

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  main { padding: 24px 18px 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
}
