:root {
  --green: #0B3220;
  --green-light: #123D29;
  --green-tint: #F3F8F5;
  --accent: #E1436A;
  --accent-tint: #FDF3F6;
  --text: #15171C;
  --muted: #6B7280;
  --border: #E7E8EC;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #F4F5F7; color: var(--text); }
.app { display: flex; min-height: 100vh; }

.sidebar { width: 230px; background: var(--green); color: #CFE0D6; display: flex; flex-direction: column; }
.sidebar .brand { padding: 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand img { height: 34px; width: auto; display: block; }
.sidebar nav { flex: 1; display: flex; flex-direction: column; padding: 12px; gap: 2px; }
.sidebar nav a { color: #9FBBA9; text-decoration: none; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 500; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.12); color: #fff; }
.nav-section { padding: 12px 12px 4px; font-size: 11px; text-transform: uppercase; color: #6E8A78; }
.user-box { padding: 15px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.btn-logout { display: inline-block; margin-top: 6px; color: #F0A6B8; text-decoration: none; }

.content { flex: 1; padding: 30px; }
.card { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 1px 3px rgba(15,15,20,.05); margin-bottom: 20px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: #fff; }
table th, table td { padding: 10px 12px; border-bottom: 1px solid #F0F1F3; text-align: left; font-size: 13.5px; }
table th { background: var(--green-tint); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: #6B7280; font-weight: 600; }
table tbody tr:hover { background: #FAFAFB; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; background: var(--green); color: #fff; border: none; border-radius: 8px; cursor: pointer; text-decoration: none; font-size: 13.5px; font-weight: 500; }
.btn:hover { background: var(--green-light); }
.btn-accent { background: var(--accent); }
.btn-accent:hover { background: #C93760; }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #F4F5F7; }
.btn-danger { background: #C0392B; }
.btn-whatsapp { background: #25D366; }
.btn-whatsapp:hover { background: #1EBE5A; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 13px; color: #374151; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(11,50,32,.1);
}
.search-box { position: relative; }
.search-box input { padding-left: 34px !important; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #9599A6; }

.radio-group { border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; }
.radio-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid #F0F1F3; cursor: pointer; }
.radio-row:last-child { border-bottom: none; }
.radio-row input[type=radio] { margin-top: 3px; accent-color: var(--green); width: 16px; height: 16px; }
.radio-row .label { font-size: 13.5px; font-weight: 500; }
.radio-row .desc { font-size: 11.5px; color: #9599A6; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.stat-box { background: #fff; border-radius: 14px; padding: 18px; box-shadow: 0 1px 3px rgba(15,15,20,.05); border: 1px solid var(--border); }
.stat-box .icon { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; font-size: 16px; }
.stat-box .num { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.stat-box .label { font-size: 12px; color: #6B7280; margin-top: 3px; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 15px; font-size: 13.5px; }
.alert-success { background: #E9F7EE; color: #1F9D55; }
.alert-error { background: #FDEEEE; color: #D64545; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500; }
.badge-in::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #1F9D55; }
.badge-out::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #D64545; }
.badge-in { color: #1F9D55; }
.badge-out { color: #D64545; }
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 15px; flex-wrap: wrap; }
.top-bar h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.top-bar p.subtitle { font-size: 13px; color: #6B7280; margin-top: 3px; }
.qty-control { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.qty-btn { width: 32px; height: 32px; border-radius: 8px; border: none; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; font-weight: 600; }
.qty-btn.minus { background: var(--green); }
.qty-btn.plus { background: var(--accent); }
.qty-input { width: 56px !important; text-align: center; padding: 7px !important; }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 999; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.open { display: flex; }
.modal-box { background: #fff; border-radius: 14px; width: 100%; max-width: 440px; box-shadow: 0 20px 50px rgba(0,0,0,.2); overflow: hidden; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #F0F1F3; }
.modal-header h3 { font-size: 14.5px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #9599A6; line-height: 1; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid #F0F1F3; display: flex; justify-content: flex-end; gap: 8px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
.mobile-topbar { display: none; align-items: center; justify-content: space-between; background: var(--green); padding: 12px 16px; position: sticky; top: 0; z-index: 500; }
.mobile-topbar img { height: 26px; filter: brightness(0) invert(1); }
.hamburger { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 4px 8px; line-height: 1; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 998; }
.sidebar-overlay.open { display: block; }
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 250px; z-index: 999;
    transform: translateX(-100%); transition: transform .25s ease; box-shadow: 4px 0 20px rgba(0,0,0,.2);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-topbar { display: flex; }
  .content { padding: 18px 14px; }

  .top-bar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .top-bar > *:last-child { width: 100%; }
  .top-bar .btn { width: 100%; justify-content: center; }

  .grid-2, .grid-4,
  [style*="grid-template-columns"] {
    display: flex !important;
    flex-direction: column !important;
  }

  .card { overflow-x: auto; }
  table { min-width: 560px; }

  .qty-control { justify-content: flex-start; }
  .modal-box { max-width: 94vw !important; margin: 0 8px; }

  form[method="get"].form-group,
  form[method="get"] { max-width: 100% !important; }
  form[style*="display:flex"],
  form[style*="display: flex"] { flex-wrap: wrap !important; }
  form[style*="display:flex"] .form-group,
  form[style*="display: flex"] .form-group { flex: 1 1 140px; }
}

@media (max-width: 600px) {
  .stat-box .num { font-size: 19px; }
  .content { padding: 14px 10px; }
  .card { padding: 15px; border-radius: 12px; }
  table th, table td { font-size: 12px; padding: 8px 10px; }
  .btn { padding: 8px 12px; font-size: 12.5px; }
  .login-box { width: 92vw !important; padding: 28px 22px !important; }
}
