/* ============================================================
   GENKI NETWORK PORTAL — Design System
   Color tokens dari Stitch (Material Design 3 - Green/Red)
   Font: Inter | Icons: Material Symbols Outlined
   ============================================================ */

:root {
  /* Primary (hijau gelap — sidebar, tombol utama) */
  --primary:          #1f5722;
  --primary-cont:     #387038;
  --on-primary:       #ffffff;
  --inv-primary:      #98d692;

  /* Secondary (merah — frozen, warning) */
  --secondary:        #bb0200;
  --secondary-cont:   #e42113;

  /* Tertiary (hijau muda — badge organic, icon bg) */
  --tertiary:         #285627;
  --tertiary-fixed:   #bbf0b2;
  --tertiary-cont:    #406f3d;

  /* Surface */
  --bg:               #f8f9fb;
  --surface:          #f8f9fb;
  --surface-lo:       #f3f4f6;
  --surface-white:    #ffffff;
  --surface-cont:     #edeef0;
  --surface-hi:       #e7e8ea;
  --surface-highest:  #e1e2e4;

  /* Text */
  --ink:              #191c1e;
  --ink-sec:          #41493f;
  --muted:            #71796e;

  /* Border */
  --line:             #c1c9bb;
  --line-light:       #e1e2e4;

  /* Semantic */
  --green:            #1f5722;
  --green-val:        #285627;
  --red:              #ba1a1a;
  --red-cont:         #ffdad6;

  /* Spacing */
  --sidebar-w:        260px;
  --topbar-h:         64px;
  --pad:              24px;
  --gap:              20px;
  --radius:           8px;
  --radius-lg:        12px;
  --radius-xl:        16px;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Material Symbols ───────────────────────────────────── */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
  flex-shrink: 0;
}
.icon-filled { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, #0d3b0f 100%);
}
.login-box {
  background: var(--surface-white);
  padding: 40px;
  border-radius: var(--radius-xl);
  width: 360px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}
.login-logo .material-symbols-outlined {
  font-size: 32px;
  color: var(--primary);
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 40;
}
.login-box h1 {
  color: var(--primary);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2px;
}
.subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 28px;
}
.login-box label { display: block; margin: 14px 0 5px; font-weight: 600; font-size: 13px; }
.login-box input {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line-light);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.login-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31,87,34,.1);
}

/* ============================================================
   LAYOUT
   ============================================================ */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100%;
  z-index: 200;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.25) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.25);
  border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.4); }
.sidebar-brand {
  padding: 22px 20px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.sidebar-brand-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-brand-icon .material-symbols-outlined {
  font-size: 20px; color: var(--inv-primary);
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
.sidebar-brand-text { min-width: 0; flex: 1; }
.sidebar-brand-text h1 { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; }
.sidebar-brand-text p  { font-size: 11px; color: rgba(255,255,255,.6); margin-top: 1px; }

.sidebar nav {
  padding: 12px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.sidebar nav a:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.sidebar nav a.nav-active {
  background: rgba(255,255,255,.14);
  color: #fff;
  font-weight: 600;
  border-left-color: var(--inv-primary);
}
.sidebar nav a .material-symbols-outlined { font-size: 18px; opacity: .85; }
.sidebar nav a.nav-active .material-symbols-outlined { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: #e53935;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 7px;
  border-radius: 99px;
}

/* Close button (mobile only) */
.brand {
  padding: 20px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-close {
  display: none;
  background: none; border: none;
  color: rgba(255,255,255,.7);
  font-size: 18px; cursor: pointer;
  padding: 4px 8px; border-radius: 4px; line-height: 1;
}
.sidebar-close:hover { color: #fff; background: rgba(255,255,255,.15); }

/* ── Content area ───────────────────────────────────────── */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-w);
  min-width: 0;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  background: var(--surface-white);
  height: var(--topbar-h);
  padding: 0 var(--pad);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line-light);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-greeting { font-size: 14px; color: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px; border-radius: var(--radius);
  cursor: pointer; transition: background .15s;
}
.topbar-user:hover { background: var(--surface-lo); }
.topbar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-cont);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-light);
}
.topbar-avatar .material-symbols-outlined { font-size: 18px; color: var(--ink-sec); }

/* ── Page canvas ────────────────────────────────────────── */
.page { padding: var(--pad); }

h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.3; margin-bottom: 4px; }
.muted { color: var(--muted); }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-hd {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--gap);
}
.page-hd h1 { margin-bottom: 2px; }
.page-hd p  { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ============================================================
   CARDS (summary / KPI)
   ============================================================ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--gap);
  margin-top: var(--gap);
}
.card {
  background: var(--surface-white);
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-light);
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.09); transform: translateY(-1px); }
.card-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
  flex-shrink: 0;
}
.card-icon-green { background: var(--tertiary-fixed); color: var(--primary); }
.card-icon-red   { background: #ffdad6; color: var(--red); }
.card-icon-blue  { background: #dbeafe; color: #1d4ed8; }
.card-icon-amber { background: #fef3c7; color: #b45309; }
.card-icon-gray  { background: var(--surface-cont); color: var(--ink-sec); }
.card-label { color: var(--muted); font-size: 12px; font-weight: 500; }
.card-val   { font-size: 20px; font-weight: 700; line-height: 1.2; }
.text-green { color: var(--green-val); }
.text-red   { color: var(--red); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid var(--line-light);
  border-radius: var(--radius);
  background: var(--surface-white);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  transition: background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-lo); border-color: var(--line); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; margin-top: 18px; padding: 12px; }

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
  box-shadow: 0 1px 4px rgba(31,87,34,.25);
}
.btn-primary:hover { background: var(--primary-cont); border-color: var(--primary-cont); }

.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-danger:hover { background: #93000a; border-color: #93000a; }

.btn-secondary {
  background: #455a64;
  color: #fff;
  border-color: #455a64;
}
.btn-secondary:hover { background: #37474f; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: var(--red-cont); color: var(--red); border: 1px solid #fca5a5; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  background: var(--surface-white);
  border: 1px solid var(--line-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line-light);
}
th {
  background: var(--surface-lo);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
tbody tr:hover { background: var(--surface-lo); }
tbody tr:last-child td { border-bottom: none; }
tfoot tr td { background: var(--surface-lo); font-weight: 600; border-top: 2px solid var(--line-light); }

/* ============================================================
   TOOLBAR & FILTERS
   ============================================================ */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 10px;
  flex-wrap: wrap;
}
.toolbar-left { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.search-box, .filter-select,
input[type=text], input[type=number], input[type=email],
input[type=date], input[type=month], input[type=password],
select, textarea {
  padding: 8px 12px;
  border: 1.5px solid var(--line-light);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-family: inherit;
  background: var(--surface-white);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus, .filter-select:focus,
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31,87,34,.08);
}
.search-box { min-width: 210px; }
.filter-select { min-width: 120px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 16px;
}
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1.5px solid var(--line-light);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .disabled { color: var(--muted); pointer-events: none; opacity: .5; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge-organic  { background: #dcfce7; color: #166534; }
.badge-frozen   { background: #fee2e2; color: #991b1b; }
.badge-active   { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fce4ec; color: #9b1c1c; }
.badge-tetap    { background: #dbeafe; color: #1e40af; }
.badge-packing  { background: #fef3c7; color: #92400e; }
.badge-keduanya { background: #f3e5f5; color: #6b21a8; }
.badge-berjalan { background: #fef3c7; color: #92400e; }
.badge-selesai  { background: #dcfce7; color: #166534; }

/* ============================================================
   FORMS
   ============================================================ */
.form-wrap {
  background: var(--surface-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-light);
  padding: 28px 32px;
  max-width: 840px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-group { margin-bottom: 16px; }
.form-row > .form-group { margin-bottom: 0; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink-sec);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.form-group input[type=text],
.form-group input[type=number],
.form-group input[type=email],
.form-group input[type=date],
.form-group input[type=month],
.form-group input[type=password],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line-light);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31,87,34,.08);
}
.form-group small  { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.form-check input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
.form-check label  { font-size: 14px; cursor: pointer; margin: 0; }
.form-actions {
  display: flex; gap: 10px; margin-top: 8px;
  padding-top: 20px; border-top: 1px solid var(--line-light);
}
.req { color: var(--red); }

/* ============================================================
   MISC
   ============================================================ */
.stock-low { color: var(--red); font-weight: 700; }

/* Card shadow utility */
.card-shadow { box-shadow: 0 2px 8px rgba(0,0,0,.06); }

/* Section card (e.g. dashboard panels) */
.panel {
  background: var(--surface-white);
  border: 1px solid var(--line-light);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.panel-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
}
.panel-title .muted { font-size: 12px; font-weight: 400; margin-left: 4px; }

/* Overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199; cursor: pointer;
}
.sidebar-overlay.visible { display: block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
.hamburger {
  display: none;
  align-items: center; justify-content: center;
  background: none; border: none;
  font-size: 22px; cursor: pointer;
  color: var(--ink); padding: 5px 7px; border-radius: 6px; flex-shrink: 0;
}
.hamburger:hover { background: rgba(0,0,0,.06); }

/* ── Tablet 768–1023px ─────────────────────────────────── */
@media (min-width:768px) and (max-width:1023px) {
  :root { --sidebar-w: 210px; --pad: 18px; }
  .sidebar nav a { font-size: 13px; }
  .page { padding: 20px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}

/* ── Mobile ≤ 767px ────────────────────────────────────── */
@media (max-width:767px) {
  :root { --sidebar-w: 270px; }

  .hamburger { display: flex; }
  .sidebar-close { display: block; }

  .layout { display: block; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .24s ease;
  }
  .sidebar.open { transform: translateX(0); }

  body.sidebar-open { overflow: hidden; }

  .content { width: 100%; margin-left: 0; min-width: 0; }

  .topbar { padding: 0 14px; }
  .page   { padding: 16px 14px; }
  h1      { font-size: 20px; }

  .page-hd { flex-direction: column; gap: 10px; align-items: stretch; }
  .page-hd > .btn,
  .page-hd > a.btn { display: block; text-align: center; }
  .page-hd > div { display: flex; flex-direction: column; gap: 8px; }
  .page-hd > div .btn { text-align: center; justify-content: center; }

  .cards { grid-template-columns: repeat(2,1fr); gap: 10px; margin-top: 12px; }
  .card  { padding: 14px; }
  .card-val { font-size: 17px; }

  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .form-wrap { padding: 18px 16px; max-width: 100%; border-radius: var(--radius); }
  .form-row, .form-row.cols-3 { grid-template-columns: 1fr; }

  form > div[style*="grid-template-columns"],
  form > div[style*="grid-template-column"] {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }
  form > div[style*="display:flex"],
  form > div[style*="display: flex"] { flex-wrap: wrap !important; }

  input[type=text], input[type=number], input[type=email],
  input[type=date], input[type=month], input[type=password],
  select, textarea {
    min-height: 44px; font-size: 16px !important; padding: 10px 12px !important;
  }
  .btn     { min-height: 44px; }
  .btn-sm  { min-height: 36px; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { text-align: center; justify-content: center; }
  .login-box { width: calc(100% - 32px); padding: 28px 20px; }
}

/* ── Tiny ≤ 399px ─────────────────────────────────────── */
@media (max-width:399px) {
  .cards { grid-template-columns: 1fr; }
  .topbar-greeting { display: none; }
  .page { padding: 14px 12px; }
}
