/* =========================================================
   ADMIN.CSS — dashboard pengelolaan Interone x YH LED
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #fffdee;
  --surface: #ffffff;
  --surface-soft: #f2fbe6;
  --text: #17231f;
  --text-muted: #607069;
  --border: #e2e9df;
  --primary: #076653;
  --primary-dark: #0c342c;
  --deep: #06231d;
  --accent: #e3ef26;
  --success: #147a5c;
  --warning: #a97c00;
  --danger: #b53b32;
  --font-display: 'Plus Jakarta Sans', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 4px 14px rgba(12, 52, 44, .06);
  --shadow-md: 0 14px 34px rgba(12, 52, 44, .10);
  --sidebar-w: 250px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); color: var(--text); background: var(--bg); line-height: 1.55; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.25; color: var(--primary-dark); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- LOGIN ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 20% 20%, #e2fbce 0%, #fffdee 55%); padding: 24px; }
.login-card { width: 100%; max-width: 960px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); display: grid; grid-template-columns: 1.1fr 1fr; overflow: hidden; }
.login-side { background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 100%); color: #fff; padding: 44px 38px; display: flex; flex-direction: column; justify-content: space-between; }
.login-side img { width: 170px; height: auto; background: #fff; border-radius: 10px; padding: 6px 10px; }
.login-side h2 { color: #fff; font-size: 22px; margin: 26px 0 10px; }
.login-side p { color: #cfe7dc; font-size: 13.5px; }
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.role-chip { border: 1px solid rgba(255,255,255,.25); border-radius: var(--radius-sm); padding: 12px; cursor: pointer; background: rgba(255,255,255,.06); transition: background .15s ease, border-color .15s ease; }
.role-chip.active { background: var(--accent); border-color: var(--accent); }
.role-chip.active, .role-chip.active .role-desc { color: var(--primary-dark); }
.role-chip strong { display: block; font-family: var(--font-display); font-size: 13px; }
.role-chip .role-desc { display: block; font-size: 11px; color: #cfe7dc; margin-top: 3px; }
.login-form-wrap { padding: 44px 38px; display: flex; flex-direction: column; justify-content: center; }
.login-form-wrap h1 { font-size: 24px; margin-bottom: 6px; }
.login-form-wrap > p { color: var(--text-muted); font-size: 13.5px; margin-bottom: 26px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 6px; color: var(--primary-dark); }
.field input, .field select, .field textarea { width: 100%; padding: 11px 13px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: #fff; font-size: 13.5px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field .error-text { display: none; color: var(--danger); font-size: 11.5px; margin-top: 5px; }
.field.has-error input, .field.has-error select { border-color: var(--danger); }
.field.has-error .error-text { display: block; }
.form-msg { font-size: 12.5px; font-weight: 700; padding: 10px 13px; border-radius: var(--radius-sm); margin-bottom: 16px; display: none; }
.form-msg.show { display: block; }
.form-msg.error { background: #fbeae8; color: var(--danger); }
.form-msg.success { background: #e5f5ec; color: var(--success); }
.demo-box { margin-top: 22px; background: var(--surface-soft); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 11.5px; color: var(--text-muted); }
.demo-box b { color: var(--primary-dark); }
.demo-box code { background: #fff; padding: 1px 5px; border-radius: 5px; border: 1px solid var(--border); }
.back-store { display: inline-block; margin-top: 18px; font-size: 12px; color: var(--primary); font-weight: 700; }
@media (max-width: 780px) { .login-card { grid-template-columns: 1fr; } .login-side { display: none; } }

/* ---------- LAYOUT DASHBOARD ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); flex: 0 0 auto; background: var(--primary-dark); color: #eaf5ef; padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.sidebar-brand img { width: 40px; height: 40px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; }
.sidebar-brand span { font-family: var(--font-display); font-weight: 800; font-size: 14px; color: #fff; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 700; color: #cfe7dc; margin-bottom: 4px; transition: background .15s ease, color .15s ease; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: var(--accent); color: var(--primary-dark); }
.sidebar-nav .ico, .sidebar-foot .ico { width: 18px; height: 18px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-nav .ico svg, .sidebar-foot .ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-foot { margin-top: 26px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-foot a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; color: #cfe7dc; }
.sidebar-foot a:hover { background: rgba(255,255,255,.06); color: #fff; }

.admin-main { flex: 1; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; background: rgba(255,253,238,.95); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); padding: 16px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.topbar h1 { font-size: 19px; }
.topbar .page-desc { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px 6px 6px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--primary-dark); font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.user-chip .u-name { font-size: 12.5px; font-weight: 700; display: block; }
.user-chip .u-role { font-size: 10.5px; color: var(--text-muted); display: block; }
.menu-toggle { display: none; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); width: 40px; height: 40px; cursor: pointer; color: var(--primary-dark); }
.menu-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.admin-content { padding: 26px 28px 60px; }

/* ---------- KOMPONEN ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat-card .label { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.stat-card .value { font-family: var(--font-display); font-size: 25px; font-weight: 800; color: var(--primary-dark); margin-top: 8px; }
.stat-card .delta { font-size: 11.5px; font-weight: 700; margin-top: 6px; color: var(--success); }
.stat-card .delta.down { color: var(--danger); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px 22px; margin-bottom: 22px; box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { font-size: 16px; }
.panel-head p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 18px; border-radius: var(--radius-sm); font-family: var(--font-display); font-weight: 800; font-size: 12.5px; border: none; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: var(--primary-dark); }
.btn-accent:hover { background: #d8e61a; }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--surface-soft); }
.btn-danger { background: #fbeae8; color: var(--danger); }
.btn-danger:hover { background: #f6d6d2; }
.btn-sm { padding: 7px 12px; font-size: 11.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 800; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.badge.role-super-admin { background: #e5f5ec; color: var(--success); }
.badge.role-spv { background: #e6f0ff; color: #1d4ed8; }
.badge.role-staff { background: #fff6cf; color: var(--warning); }
.badge.role-customer { background: #f1e9ff; color: #6b21a8; }
.badge.on { background: #e5f5ec; color: var(--success); }
.badge.off { background: #fbeae8; color: var(--danger); }
.badge.status-menunggu { background: #fff6cf; color: var(--warning); }
.badge.status-diproses { background: #e6f0ff; color: #1d4ed8; }
.badge.status-selesai { background: #e5f5ec; color: var(--success); }
.badge.status-batal { background: #fbeae8; color: var(--danger); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: var(--surface-soft); }
.table-wrap { overflow-x: auto; }
.table-actions { display: flex; gap: 8px; }
.empty-row { text-align: center; padding: 30px; color: var(--text-muted); font-size: 13px; }

.thumb-sm { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--surface-soft); }
.prod-name-cell { display: flex; align-items: center; gap: 10px; }
.prod-name-cell strong { font-size: 13px; }
.prod-name-cell small { color: var(--text-muted); font-size: 11px; }

.activity-list { display: flex; flex-direction: column; gap: 0; max-height: 420px; overflow-y: auto; }
.activity-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: 0 0 auto; }
.activity-item p { font-size: 12.5px; }
.activity-item time { font-size: 11px; color: var(--text-muted); }

.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.chip-toggle { display: inline-flex; gap: 6px; background: var(--surface-soft); border-radius: 999px; padding: 4px; }
.chip-toggle button { border: none; background: transparent; padding: 8px 16px; border-radius: 999px; font-weight: 700; font-size: 12px; cursor: pointer; color: var(--text-muted); }
.chip-toggle button.active { background: var(--primary); color: #fff; }
.export-row { display: flex; gap: 8px; flex-wrap: wrap; }

.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar-chart .bar { width: 100%; max-width: 34px; background: linear-gradient(180deg, var(--accent), var(--primary)); border-radius: 8px 8px 3px 3px; min-height: 4px; }
.bar-chart .bar-label { font-size: 10.5px; color: var(--text-muted); font-weight: 700; }

.modal-overlay { position: fixed; inset: 0; background: rgba(6,35,29,.55); display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal-overlay.show { display: flex; }
.modal-box { background: #fff; border-radius: var(--radius-lg); max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 26px 26px 24px; box-shadow: var(--shadow-md); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h3 { font-size: 17px; }
.modal-close { background: var(--surface-soft); border: none; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 16px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

.toast-admin { position: fixed; bottom: 24px; right: 24px; background: var(--primary-dark); color: #fff; padding: 13px 20px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; box-shadow: var(--shadow-md); opacity: 0; transform: translateY(10px); transition: opacity .25s ease, transform .25s ease; z-index: 200; pointer-events: none; }
.toast-admin.show { opacity: 1; transform: translateY(0); }

.perm-note { background: #fff6cf; color: var(--warning); font-size: 12px; font-weight: 700; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; }

.upload-box { border: 1.5px dashed var(--border); border-radius: var(--radius-sm); padding: 14px; cursor: pointer; text-align: center; background: var(--surface-soft); transition: border-color .15s ease; }
.upload-box:hover { border-color: var(--primary); }
.upload-placeholder { display: block; font-size: 12px; color: var(--text-muted); font-weight: 700; }
.upload-box img { max-width: 100%; max-height: 140px; border-radius: 8px; margin: 0 auto 8px; display: block; }
.galeri-preview-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.galeri-thumb { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); aspect-ratio: 1/1; }
.galeri-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.galeri-thumb button { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: none; background: rgba(181,59,50,.9); color: #fff; font-size: 12px; cursor: pointer; line-height: 1; padding: 0; }

@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: -260px; z-index: 50; transition: left .2s ease; box-shadow: var(--shadow-md); }
  .sidebar.open { left: 0; }
  .menu-toggle { display: block; }
  .admin-content { padding: 20px 16px 50px; }
  .topbar { padding: 14px 16px; }
  .form-grid-2 { grid-template-columns: 1fr; }
}
