/* ============================================================
   ARIES ONE — Base Stylesheet
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f4f5f7;
  --surface:   #ffffff;
  --border:    #dde1e7;
  --primary:   #2563eb;
  --primary-h: #1d4ed8;
  --danger:    #dc2626;
  --danger-h:  #b91c1c;
  --success:   #16a34a;
  --warn:      #d97706;
  --text:      #1e293b;
  --text-muted:#64748b;
  --radius:    6px;
  --shadow:    0 1px 3px rgba(0,0,0,.1);
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---- Topbar ---- */
.topbar {
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  padding: 0 16px 0 0;
  height: 48px;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(0,0,0,.22);
}
.topbar-brand {
  font-weight: 700; font-size: 15px; letter-spacing: .5px;
  padding: 0 18px; display: flex; align-items: center;
  white-space: nowrap; flex-shrink: 0;
}
.topbar-right {
  display: flex; align-items: center; gap: 14px;
  font-size: 13px; flex-shrink: 0;
}
.topbar-right a { color: #ffffffcc; text-decoration: none; }
.topbar-right a:hover { color: #fff; }
.hamburger {
  display: none; background: none; border: none;
  color: #fff; font-size: 20px; cursor: pointer; padding: 0 4px;
}

/* ---- Top Navigation ---- */
.topnav {
  display: flex; align-items: stretch; flex: 1;
  overflow: visible;
}
.tnav-item {
  position: relative; display: flex; align-items: stretch;
}
.tnav-link {
  display: flex; align-items: center; gap: 4px;
  padding: 0 14px; font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.85); text-decoration: none;
  cursor: pointer; white-space: nowrap; border: none;
  background: none; height: 100%;
  border-bottom: 3px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
}
.tnav-link:hover,
.tnav-item:hover > .tnav-link { color: #fff; background: rgba(255,255,255,.1); }
.tnav-link.active { color: #fff; border-bottom-color: rgba(255,255,255,.8); }
.tnav-arrow { font-size: 10px; opacity: .7; transition: transform .2s; }
.tnav-item:hover > .tnav-link .tnav-arrow { transform: rotate(180deg); }

/* Dropdown */
.tnav-dropdown {
  display: none;
  position: absolute; top: 48px; left: 0;
  background: #fff; border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,.13);
  min-width: 200px; max-width: 280px;
  z-index: 300; padding: 6px 0;
}
.tnav-item:hover .tnav-dropdown,
.tnav-item.open  .tnav-dropdown { display: block; }

.tnav-dd-item {
  display: block; padding: 8px 16px;
  font-size: 13px; color: var(--text); text-decoration: none;
  transition: background .1s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tnav-dd-item:hover { background: #f1f5f9; color: var(--primary); }
.tnav-dd-item.active { background: #eff6ff; color: var(--primary); font-weight: 500; }

/* Group header inside dropdown */
.tnav-group { border-top: 1px solid var(--border); padding-top: 4px; margin-top: 4px; }
.tnav-group:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.tnav-group-label {
  padding: 5px 16px 3px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
}

/* ── Flyout submenu (level-2) ── */
.tnav-flyout-item {
  position: relative;
}
.tnav-flyout-trigger {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px;
  font-size: 13px; color: var(--text); text-decoration: none;
  transition: background .1s; white-space: nowrap; cursor: default;
  gap: 12px;
}
.tnav-flyout-trigger:hover { background: #f1f5f9; color: var(--primary); }
.tnav-flyout-trigger.active { background: #eff6ff; color: var(--primary); font-weight: 500; }
.tnav-flyout-arrow { font-size: 10px; opacity: .6; flex-shrink: 0; }

.tnav-flyout {
  display: none;
  position: absolute; top: -6px; left: 100%;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,.13);
  min-width: 220px; z-index: 400; padding: 6px 0;
}
/* Buka flyout saat hover pada item */
.tnav-flyout-item:hover > .tnav-flyout { display: block; }

/* Jika flyout akan terpotong di kanan layar, buka ke kiri */
.tnav-flyout-item.flyout-left > .tnav-flyout {
  left: auto; right: 100%;
}

/* ---- Mobile nav ---- */
@media (max-width: 900px) {
  .hamburger { display: flex; }
  .topnav {
    display: none; flex-direction: column;
    position: absolute; top: 48px; left: 0; right: 0;
    background: var(--primary); z-index: 250;
    padding: 8px 0; box-shadow: 0 4px 12px rgba(0,0,0,.2);
  }
  .topnav.open { display: flex; }
  .tnav-item { flex-direction: column; }
  .tnav-link { padding: 10px 20px; border-bottom: none; border-radius: 0; }
  .tnav-dropdown {
    position: static; box-shadow: none; border: none;
    background: rgba(0,0,0,.15); border-radius: 0;
    padding: 0; display: none;
  }
  .tnav-item.open .tnav-dropdown { display: block; }
  .tnav-dd-item { color: rgba(255,255,255,.85); padding: 8px 32px; }
  .tnav-dd-item:hover { background: rgba(255,255,255,.1); color: #fff; }
  .tnav-dd-item.active { background: rgba(255,255,255,.15); color: #fff; }
  .tnav-group-label { color: rgba(255,255,255,.5); padding-left: 32px; }
  .tnav-group { border-top-color: rgba(255,255,255,.15); }
  /* Mobile: flyout jadi flat expand */
  .tnav-flyout-trigger { color: rgba(255,255,255,.85); padding: 8px 32px; }
  .tnav-flyout-trigger:hover { background: rgba(255,255,255,.1); color: #fff; }
  .tnav-flyout-trigger.active { background: rgba(255,255,255,.15); color: #fff; }
  .tnav-flyout { position: static; box-shadow: none; border: none; border-radius: 0; background: rgba(0,0,0,.15); padding: 0; display: none; }
  .tnav-flyout-item.open > .tnav-flyout { display: block; }
  .tnav-flyout .tnav-dd-item { padding-left: 48px; }
}

/* ---- Layout ---- */
.page-wrapper { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }
.page-title {
  font-size: 18px; font-weight: 600; margin-bottom: 16px;
  padding-bottom: 10px; border-bottom: 2px solid var(--primary);
  color: var(--text);
}
.page-title span { color: var(--text-muted); font-weight: 400; font-size: 13px; margin-left: 8px; }

/* ---- Card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  background: #f8fafc;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-body { padding: 16px; }

/* ---- Form ---- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px 16px;
}
.form-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 500; color: var(--text-muted); }
input[type=text], input[type=number], input[type=password],
select, textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
input[readonly] { background: #f8fafc; color: var(--text-muted); }
textarea { resize: vertical; min-height: 60px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; font-family: inherit;
  border: 1px solid transparent; cursor: pointer;
  text-decoration: none; transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-h); border-color: var(--primary-h); }
.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-h); border-color: var(--danger-h); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-success  { background: var(--success); color: #fff; border-color: var(--success); }
.btn-sm { padding: 4px 9px; font-size: 12px; }

/* ---- Toolbar (above table) ---- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 12px;
}
.toolbar-left, .toolbar-right { display: flex; gap: 8px; align-items: center; }
.search-box {
  display: flex; align-items: center; gap: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: #fff;
}
.search-box input {
  border: none; border-radius: 0; width: 220px; padding: 6px 10px;
  box-shadow: none;
}
.search-box input:focus { box-shadow: none; border: none; }
.search-box button {
  background: var(--primary); color: #fff; border: none;
  padding: 0 12px; cursor: pointer; font-size: 14px; height: 100%;
}

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: #f1f5f9; color: var(--text-muted);
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; padding: 9px 12px;
  border-bottom: 1px solid var(--border); text-align: left;
  white-space: nowrap;
}
thead th.center { text-align: center; }
tbody tr { border-bottom: 1px solid #f0f2f5; transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
tbody td { padding: 8px 12px; vertical-align: middle; }
tbody td.center { text-align: center; }
tbody td.right  { text-align: right; }
.td-actions { display: flex; gap: 5px; justify-content: center; }

/* ---- Badge ---- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 500;
}
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-gray   { background: #f1f5f9; color: #64748b; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-red    { background: #fee2e2; color: #dc2626; }
.badge-amber  { background: #fef3c7; color: #92400e; }

/* ---- Alert ---- */
.alert {
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 14px;
  border-left: 4px solid transparent;
}
.alert-success { background: #f0fdf4; border-color: var(--success); color: #15803d; }
.alert-danger  { background: #fef2f2; border-color: var(--danger);  color: #dc2626; }
.alert-info    { background: #eff6ff; border-color: var(--primary);  color: #1d4ed8; }

/* ---- Subscription warning banner (BUKAN .alert - sengaja terpisah supaya
   tidak ikut ke-auto-hide oleh script 4 detik di layout.php) ---- */
.subs-warning-banner {
  background: #fffbeb; border: 1px solid var(--warn); color: #92400e;
  padding: 10px 16px; border-radius: var(--radius); font-size: 13px;
  margin-bottom: 16px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.subs-warning-banner a { color: #92400e; font-weight: 700; text-decoration: underline; white-space: nowrap; }

/* ---- Modal ---- */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
  width: 100%; max-height: 90vh; overflow-y: auto;
  animation: modal-in .15s ease;
}
.modal-sm  { max-width: 400px; }
.modal-md  { max-width: 600px; }
.modal-lg  { max-width: 820px; }
.modal-xl  { max-width: 1000px; }
@keyframes modal-in { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 600; font-size: 15px;
}
.modal-body   { padding: 18px; }
.modal-footer {
  padding: 12px 18px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}
.btn-close {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--text-muted); line-height: 1;
}
.btn-close:hover { color: var(--text); }

/* ---- Pagination ---- */
.pagination { display: flex; gap: 4px; align-items: center; margin-top: 14px; }
.pagination a, .pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 6px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 12px; text-decoration: none; color: var(--text);
  background: #fff;
}
.pagination a:hover { background: var(--bg); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { color: var(--text-muted); pointer-events: none; background: #f8fafc; }

/* ---- Misc ---- */
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-right  { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }

/* ---- Confirm dialog ---- */
#confirm-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 300;
  align-items: center; justify-content: center;
}
#confirm-backdrop.open { display: flex; }
#confirm-box {
  background: #fff; border-radius: 8px; padding: 24px;
  max-width: 360px; width: 100%; text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
#confirm-box .ci { font-size: 36px; margin-bottom: 10px; }
#confirm-box p { font-size: 14px; margin-bottom: 18px; color: var(--text); }
#confirm-box .btns { display: flex; gap: 10px; justify-content: center; }

/* ============================================================
   ARIES ONE v3 — Enhanced UI + Modal Form styles
   ============================================================ */

/* ---- Base size upgrade ---- */
body { font-size: 15px; }
label { font-size: 13px; font-weight: 600; color: #374151; }
input[type=text], input[type=number], input[type=password], select, textarea {
  padding: 9px 12px; font-size: 14px; border-radius: 7px;
  border: 1.5px solid var(--border);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.13);
}
.btn { padding: 9px 18px; font-size: 14px; border-radius: 7px; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ---- Page title ---- */
.page-title {
  font-size: 20px; font-weight: 700; margin-bottom: 20px;
  padding-bottom: 12px; border-bottom: 3px solid var(--primary);
}
.page-title span { font-size: 14px; font-weight: 400; color: var(--text-muted); margin-left: 10px; }

/* ---- Card upgrade ---- */
.card { border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.07); border: 1px solid #e5e7eb; }
.card-header { padding: 14px 20px; font-size: 14px; font-weight: 700; background: #f8fafc; border-radius: 10px 10px 0 0; }
.card-body { padding: 20px; }

/* ---- Table upgrade ---- */
thead th {
  padding: 11px 14px; font-size: 12px; font-weight: 700;
  background: #f1f5f9; color: #475569;
  text-transform: uppercase; letter-spacing: .05em;
}
tbody td { padding: 11px 14px; font-size: 14px; }
tbody tr:hover { background: #f0f7ff; }

/* ---- Section header inside modal/form ---- */
.section-hdr {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; padding: 7px 12px; border-radius: 6px;
  margin: 18px 0 12px; display: flex; align-items: center; gap: 8px;
}
.section-hdr.blue   { background: #dbeafe; color: #1e40af; border-left: 4px solid #3b82f6; }
.section-hdr.green  { background: #dcfce7; color: #15803d; border-left: 4px solid #22c55e; }
.section-hdr.amber  { background: #fef3c7; color: #92400e; border-left: 4px solid #f59e0b; }
.section-hdr.purple { background: #ede9fe; color: #5b21b6; border-left: 4px solid #8b5cf6; }
.section-hdr.slate  { background: #f1f5f9; color: #334155; border-left: 4px solid #94a3b8; }

/* ---- Modal upgrade ---- */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.55); z-index: 500;
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 12px; width: 100%;
  max-height: 92vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  animation: modal-in .18s ease;
}
.modal-sm  { max-width: 440px; }
.modal-md  { max-width: 640px; }
.modal-lg  { max-width: 860px; }
.modal-xl  { max-width: 1040px; }
@keyframes modal-in {
  from { transform: translateY(-16px) scale(.98); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.modal-header {
  padding: 18px 22px; border-bottom: 1px solid #e5e7eb;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 16px; font-weight: 700; color: var(--text);
  position: sticky; top: 0; background: #fff; z-index: 10;
  border-radius: 12px 12px 0 0;
}
.modal-body   { padding: 22px; }
.modal-footer {
  padding: 14px 22px; border-top: 1px solid #e5e7eb;
  display: flex; justify-content: flex-end; gap: 10px;
  position: sticky; bottom: 0; background: #f8fafc;
  border-radius: 0 0 12px 12px;
}
.btn-close {
  background: #f1f5f9; border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 16px; color: #64748b; display: flex;
  align-items: center; justify-content: center;
  transition: background .15s;
}
.btn-close:hover { background: #e2e8f0; color: #1e293b; }

/* ---- Auto-code badge ---- */
.auto-code {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eff6ff; color: #1d4ed8; border: 1.5px solid #bfdbfe;
  border-radius: 7px; padding: 8px 14px; font-size: 14px;
  font-family: monospace; font-weight: 700; letter-spacing: .05em;
}
.auto-code small { font-size: 11px; color: #60a5fa; font-family: sans-serif; font-weight: 400; display: block; margin-top: 1px; }

/* ---- Satuan builder (setstok) ---- */
.satuan-row {
  display: grid;
  grid-template-columns: 28px minmax(90px,1.2fr) 70px minmax(110px,1.5fr) 28px;
  gap: 8px; align-items: end;
  padding: 10px 12px; background: #f8fafc;
  border: 1px solid #e5e7eb; border-radius: 8px; margin-bottom: 8px;
}
.satuan-row .level-badge {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: #dbeafe; color: #1d4ed8; flex-shrink: 0;
}
.satuan-row.level-1 { background: #eff6ff; border-color: #bfdbfe; }
.satuan-row.level-1 .level-badge { background: #2563eb; color: #fff; }
.satuan-remove {
  background: none; border: none; cursor: pointer;
  color: #94a3b8; font-size: 18px; padding: 0;
  transition: color .15s;
}
.satuan-remove:hover { color: #dc2626; }

/* ---- Barcode row ---- */
.barcode-row {
  display: grid; grid-template-columns: 1fr auto;
  gap: 8px; align-items: center;
  margin-bottom: 8px;
}
.barcode-remove {
  background: none; border: 1px solid #fca5a5; color: #dc2626;
  border-radius: 6px; cursor: pointer; padding: 6px 10px; font-size: 13px;
  transition: background .15s;
}
.barcode-remove:hover { background: #fee2e2; }

/* ---- Harga table ---- */
.harga-table { width: 100%; border-collapse: collapse; }
.harga-table th {
  background: #fef3c7; color: #92400e; font-size: 12px;
  font-weight: 700; padding: 9px 12px; text-align: left;
  border-bottom: 2px solid #fde68a;
}
.harga-table td { padding: 8px 12px; border-bottom: 1px solid #f3f4f6; }
.harga-table tr:last-child td { border-bottom: none; }
.harga-table tr.eceran td { background: #fffbeb; }
.harga-table input { width: 100%; }

/* ---- Toolbar + search upgrade ---- */
.toolbar { margin-bottom: 16px; }
.search-box input { font-size: 14px; width: 260px; padding: 8px 12px; }
.search-box button { padding: 0 14px; }

/* ---- Row action buttons ---- */
.td-actions { gap: 6px; }

/* ---- Satuan list header ---- */
.satuan-hdr {
  display: grid;
  grid-template-columns: 28px minmax(90px,1.2fr) 70px minmax(110px,1.5fr) 28px;
  gap: 8px; padding: 0 12px; margin-bottom: 4px;
}
.satuan-hdr span { font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; }

/* Kolom kalkulasi harga per satuan turunan */
.harga-table td[id^="hcalc-"] { color: #64748b; font-size: 12px; line-height: 1.7; }
