:root {
  --navy: #10172f;
  --blue: #1769aa;
  --cyan: #22a2d8;
  --line: #e5e9f0;
  --muted: #697386;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: #f4f6fa;
  color: #182033;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  min-width: 320px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

/* ============================================================
   SIDEBAR LAYOUT
   ============================================================ */
.sidebar {
  width: 260px;
  height: 100vh;
  height: 100dvh;
  background: var(--navy);
  color: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  display: grid !important;
  grid-template-rows: auto 1fr auto !important;
  padding: 20px 14px max(14px, env(safe-area-inset-bottom));
  z-index: 1000;
  transition: transform 0.22s ease, visibility 0.22s;
  overflow: hidden !important;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 18px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.brand img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 2px;
}

.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 1.5px;
  color: #aab6d0;
}

/* NAVIGASI MENU (AREA SCROLL) */
.sidebar nav {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px;
  height: 100% !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  overscroll-behavior-y: contain !important;
  scrollbar-width: thin;
  scrollbar-color: #53617d transparent;
  padding-right: 4px;
  margin-right: -2px;
}

.sidebar nav::-webkit-scrollbar {
  width: 5px;
}

.sidebar nav::-webkit-scrollbar-thumb {
  background: #53617d;
  border-radius: 8px;
}

.sidebar nav a {
  color: #c9d2e5;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0 !important;
  min-height: 40px;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: #263451;
  color: #fff;
}

.sidebar nav a.active {
  box-shadow: inset 3px 0 #22a2d8;
  font-weight: 600;
}

.sidebar-bottom {
  padding: 14px 10px 4px;
  color: #d4d9e5;
  font-size: 12px;
  background: var(--navy);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-bottom small {
  display: block;
  color: #8996b0;
  margin-top: 2px;
}

/* ============================================================
   MAIN AREA & FULL-SCREEN LAYOUT
   ============================================================ */
.main-area {
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  width: calc(100% - 260px);
}

.topbar {
  height: 70px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 500;
}

.topbar strong {
  font-size: 15px;
}

.topbar a {
  color: var(--blue);
  text-decoration: none;
}

/* KONTEN UTAMA: Menggunakan 100% lebar layar tanpa dibatasi max-width sempit */
.content {
  padding: 28px 32px;
  flex: 1;
  width: 100%;
  max-width: 100%; /* Memastikan konten melebar penuh saat Full Screen */
  min-width: 0;
}

.app-footer {
  padding: 16px 32px;
  color: #8a93a4;
  font-size: 12px;
  border-top: 1px solid var(--line);
  background: #fff;
}

/* ============================================================
   CARD, METRIC & PANEL (FULL-SCREEN OPTIMIZED)
   ============================================================ */
.metric-card,
.panel-card,
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 2px 8px rgba(19, 35, 68, 0.03);
  min-width: 0;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.metric-card {
  height: 100%;
  min-height: 115px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.metric-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-bottom: 10px;
}

.metric-dot.blue { background: #2475d0; }
.metric-dot.navy { background: #172348; }
.metric-dot.cyan { background: #22a2d8; }
.metric-dot.purple { background: #8467d8; }
.metric-dot.green { background: #1f9c76; }
.metric-dot.orange { background: #e29a3b; }

.metric-label {
  color: #697386;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.metric-value {
  font-size: clamp(18px, 1.4vw, 24px);
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #10172f;
  white-space: nowrap;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-heading a {
  font-size: 13px;
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}

.control-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  font-size: 13px;
}

.control-line strong {
  white-space: nowrap;
}

/* ============================================================
   TABLES (OPTIMIZED FOR WIDE SCREENS)
   ============================================================ */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
}

.table {
  width: 100%;
  font-size: 13px;
  margin-bottom: 0;
  --bs-table-bg: transparent;
  vertical-align: middle;
}

.table thead th {
  color: #687386;
  background: #f8f9fc;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.table td, 
.table th {
  padding: 12px 14px;
  border-color: #edf0f5;
}

.status {
  display: inline-block;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  background: #eef1f6;
  color: #596275;
}

.status-pending { background: #fff2d8; color: #936000; }
.status-approved { background: #e5f2ff; color: #155c99; }
.status-posted { background: #ddf7eb; color: #13704d; }
.status-cancelled { background: #ffe8e8; color: #a83333; }

/* ============================================================
   FORMS & BUTTONS (PERBAIKAN FULL SCREEN)
   ============================================================ */
/* Menghapus pembatasan max-width 920px agar form bisa menyesuaikan layar secara sempurna */
.form-card {
  width: 100%;
  max-width: 100%;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 6px;
}

.form-control,
.form-select {
  font-size: 13px;
  padding: 9px 12px;
  border-color: #dce2eb;
  border-radius: 8px;
  min-height: 40px;
  width: 100%;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 162, 216, 0.15);
}

textarea.form-control {
  min-height: 90px;
}

.btn {
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  min-height: 40px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-sm {
  font-size: 11px;
  padding: 5px 10px;
  min-height: 30px;
  border-radius: 6px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #e9f5fc, #f5f6fa 55%, #e5e8ef);
}

.login-card {
  width: min(100%, 420px);
  padding: 36px 32px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 50px rgba(14, 26, 51, 0.08);
  text-align: center;
}

.login-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  margin-bottom: 12px;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 800;
}

.login-card form {
  text-align: left;
}

/* ============================================================
   RESPONSIVE & FULL-SCREEN MEDIA QUERIES
   ============================================================ */
/* Layar sangat lebar (Desktop Full Screen & Ultrawide) */
@media (min-width: 1400px) {
  .content {
    padding: 32px 40px;
  }
  
  .metric-value {
    font-size: 24px;
  }
}

/* Tablet & Mobile Landscape */
@media (max-width: 991.98px) {
  body.menu-open {
    overflow: hidden;
  }
  
  .sidebar {
    width: min(280px, 85vw);
    transform: translateX(-105%);
    visibility: hidden;
    box-shadow: none;
    padding-top: max(18px, env(safe-area-inset-top));
  }

  .sidebar.open {
    transform: translateX(0);
    visibility: visible;
    box-shadow: 0 0 0 100vmax rgba(8, 19, 43, 0.55);
  }

  .main-area {
    margin-left: 0;
    width: 100%;
  }

  .topbar {
    min-height: 64px;
    height: auto;
    padding: 10px 18px;
  }

  .content {
    padding: 20px 16px;
  }

  .app-footer {
    padding: 14px 18px;
  }
}

/* Mobile Portrait */
@media (max-width: 575.98px) {
  body {
    font-size: 13px;
  }

  .content {
    padding: 14px 12px;
  }

  .metric-card {
    padding: 14px;
    min-height: 95px;
  }

  .metric-value {
    font-size: 16px;
  }

  .panel-card {
    padding: 14px;
    border-radius: 10px;
  }

  .table td, 
  .table th {
    padding: 10px 8px;
  }
}

@media print {
  body { background: #fff !important; color: #000 !important; }
  .sidebar, .topbar, #menuToggle, .app-footer, .btn, .no-print { display: none !important; }
  .main-area { margin: 0 !important; width: 100% !important; }
  .content { padding: 0 !important; }
  .panel-card, .metric-card, .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}