/* PolaButik - Main Stylesheet v4 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0F0D0B;
  --surface: #1A1714;
  --surface2: #231F1B;
  --border: #2E2922;
  --border2: #3A342D;
  --gold: #C9A84C;
  --gold-dim: rgba(201,168,76,0.1);
  --muted: #6B6057;
  --text: #D4C9BC;
  --white: #F5EFE6;
  --danger: #C0574A;
  --danger-bg: rgba(192,87,74,0.12);
  --success: #4A9B6F;
  --success-bg: rgba(74,155,111,0.12);
  --warning: #C9A84C;
  --warning-bg: rgba(201,168,76,0.12);
  --info: #4A7FC0;
  --radius: 10px;
}

/* LIGHT MODE */
[data-theme="light"] {
  --bg: #F5F0E8;
  --surface: #FFFFFF;
  --surface2: #F0EBE2;
  --border: #E0D8CC;
  --border2: #C8BFB0;
  --gold: #9A6F20;
  --gold-dim: rgba(154,111,32,0.1);
  --muted: #8A7D6E;
  --text: #2A2420;
  --white: #1A1410;
  --danger: #B04040;
  --danger-bg: rgba(176,64,64,0.1);
  --success: #3A8055;
  --success-bg: rgba(58,128,85,0.1);
  --warning: #9A6F20;
  --warning-bg: rgba(154,111,32,0.1);
  --info: #3A6FA0;
}

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

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ==================== */
/* HEADER               */
/* ==================== */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 200;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 54px;
}
.logo {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 1px;
  text-decoration: none;
  white-space: nowrap;
}
.logo em { color: var(--gold); font-style: normal; }

.main-nav {
  display: flex;
  gap: 2px;
  flex: 1;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.83rem;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: var(--surface2); }
.nav-link.active { color: var(--gold); background: var(--gold-dim); }

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.user-badge {
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.user-badge.admin { background: var(--warning-bg); color: var(--gold); border: 1px solid rgba(201,168,76,0.3); }
.user-badge.operator { background: rgba(74,127,192,0.15); color: var(--info); border: 1px solid rgba(74,127,192,0.3); }

.btn-logout {
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 9px;
  border: 1px solid var(--border2);
  border-radius: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-logout:hover { color: var(--danger); border-color: var(--danger); }

/* THEME TOGGLE */
.theme-toggle {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  width: 46px;
  height: 24px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: none;
}
.theme-toggle::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gold);
  transition: transform 0.25s;
}
[data-theme="light"] .theme-toggle::before { transform: translateX(22px); }
.theme-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.6rem;
  pointer-events: none;
  line-height: 1;
}
.theme-icon-dark { right: 4px; }
.theme-icon-light { left: 4px; }
[data-theme="light"] .theme-icon-dark { opacity: 0.3; }
[data-theme="dark"] .theme-icon-light { opacity: 0.3; }

/* ==================== */
/* BOTTOM NAV           */
/* ==================== */
.bottom-nav {
  display: none; /* hanya mobile */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 999;
  height: 60px;
}
.bottom-nav-inner {
  display: flex;
  align-items: stretch;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
}
.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 500;
  transition: color 0.2s;
  padding: 6px 0;
  overflow: hidden;
}
.bnav-item svg {
  display: block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.bnav-item span {
  display: block;
  white-space: nowrap;
}
.bnav-item.active { color: var(--gold); }

/* Scan — tombol menonjol */
.bnav-scan-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.bnav-scan {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gold);
  text-decoration: none;
  margin-top: -20px;
  box-shadow: 0 3px 12px rgba(201,168,76,0.5);
  flex-shrink: 0;
  overflow: hidden;
}
.bnav-scan svg {
  display: block;
  width: 22px;
  height: 22px;
  stroke: #0F0D0B;
  flex-shrink: 0;
}

/* ==================== */
/* FLASH                */
/* ==================== */
.flash {
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
}
.flash-success { background: var(--success-bg); color: var(--success); border-bottom: 1px solid rgba(74,155,111,0.3); }
.flash-error   { background: var(--danger-bg);  color: var(--danger);  border-bottom: 1px solid rgba(192,87,74,0.3); }
.flash-info    { background: var(--warning-bg); color: var(--warning); }

/* ==================== */
/* MAIN                 */
/* ==================== */
.app-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

/* ==================== */
/* PAGE HEADER          */
/* ==================== */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-head h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--white);
  line-height: 1;
}
.page-head p { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ==================== */
/* STATS ROW            */
/* ==================== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.stat-card .label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 5px; }
.stat-card .value { font-family: 'Cormorant Garamond', serif; font-size: 1.8rem; font-weight: 700; line-height: 1; }
.val-gold { color: var(--gold); }
.val-green { color: var(--success); }
.val-red { color: var(--danger); }
.val-blue { color: var(--info); }

/* ==================== */
/* CONTROLS             */
/* ==================== */
.controls-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 160px;
}
.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  width: 14px;
  height: 14px;
}

/* ==================== */
/* FORM CONTROLS        */
/* ==================== */
input[type="text"],
input[type="date"],
input[type="password"],
input[type="email"],
select,
textarea {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
}
input[type="text"]:focus,
input[type="date"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus { border-color: var(--gold); }

.form-input { width: 100%; padding: 10px 12px; }
.search-input { width: 100%; padding: 9px 12px 9px 34px; }
select.form-select {
  padding: 9px 26px 9px 11px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%236B6057' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-color: var(--surface);
}
textarea.form-input { resize: vertical; min-height: 75px; }

/* ==================== */
/* BUTTONS              */
/* ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: none;
  font-family: 'Outfit', sans-serif;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-gold    { background: var(--gold); color: #0F0D0B; }
.btn-gold:hover { background: #D4B05A; }
.btn-outline { background: transparent; border: 1px solid var(--border2); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-danger  { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-sm  { padding: 6px 12px; font-size: 0.78rem; }
.btn-xs  { padding: 4px 8px;  font-size: 0.72rem; }

/* ====================== */
/* PATTERN GRID & CARD    */
/* ====================== */
.pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.pattern-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.2s;
  cursor: pointer;
}
.pattern-card:hover { border-color: var(--gold); transform: translateY(-1px); }

/* Gambar swipe — rasio 3:4 */
.card-img-swipe {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--surface2);
  flex-shrink: 0;
  /* Rasio 3:4 menggunakan aspect-ratio */
  aspect-ratio: 3 / 4;
}
.card-img-swipe-inner {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease;
}
.card-img-slide {
  width: 100%;
  height: 100%;
  object-fit: cover;
  flex: 0 0 100%;
}
.card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  opacity: 0.2;
  flex: 0 0 100%;
}

/* Label & dots */
.card-img-label {
  position: absolute;
  top: 7px;
  left: 7px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.6rem;
  padding: 2px 7px;
  border-radius: 10px;
  backdrop-filter: blur(4px);
  pointer-events: none;
}
.card-img-dots {
  position: absolute;
  bottom: 7px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  pointer-events: none;
}
.card-img-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  transition: background 0.2s;
}
.card-img-dot.active { background: #fff; }

/* Card info */
.card-top {
  padding: 10px 12px 6px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
}
.card-code {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.card-sub { font-size: 0.7rem; color: var(--muted); margin-top: 1px; }

.card-body { padding: 4px 12px 8px; flex: 1; }
.card-name {
  font-size: 0.83rem;
  color: var(--text);
  font-weight: 500;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 3px;
}
.card-row span:first-child { color: var(--muted); }
.card-row span:last-child { color: var(--text); font-weight: 500; text-align: right; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.size-chips { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 5px; }
.size-chip {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.65rem;
  color: var(--text);
  font-weight: 500;
}

.card-actions {
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
}
.card-actions .btn {
  flex: 1;
  justify-content: center;
  font-size: 0.75rem;
  padding: 6px 8px;
}

/* ==================== */
/* BADGE                */
/* ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-tersedia { background: var(--success-bg); color: var(--success); border: 1px solid rgba(74,155,111,0.3); }
.badge-dipinjam { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(201,168,76,0.3); }
.badge-rusak    { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(192,87,74,0.3); }
.badge-admin    { background: var(--warning-bg); color: var(--gold);    border: 1px solid rgba(201,168,76,0.3); }
.badge-operator { background: rgba(74,127,192,0.12); color: var(--info); border: 1px solid rgba(74,127,192,0.3); }

/* ==================== */
/* TABLE                */
/* ==================== */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; min-width: 480px; }
thead { background: var(--surface2); }
th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 10px 14px;
  font-size: 0.84rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }
.td-code { font-family: 'Cormorant Garamond', serif; font-size: 1rem; color: var(--gold); font-weight: 600; }
.td-muted { color: var(--muted); font-size: 0.78rem; }

/* ==================== */
/* FORM PAGE            */
/* ==================== */
.form-page { max-width: 760px; }
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
}
.form-card h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05rem;
  color: var(--white);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.form-group { margin-bottom: 12px; }
.form-label {
  display: block;
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-hint  { font-size: 0.7rem; color: var(--muted); margin-top: 3px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }

/* Image upload */
.img-upload-wrap {
  border: 2px dashed var(--border2);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  display: block;
}
.img-upload-wrap:hover { border-color: var(--gold); }
.img-upload-wrap input { display: none; }
.img-preview { width: 100%; max-height: 160px; object-fit: cover; border-radius: 6px; margin-top: 8px; }
.img-upload-icon { font-size: 1.5rem; opacity: 0.4; margin-bottom: 4px; }
.img-upload-text { font-size: 0.78rem; color: var(--muted); }

/* ==================== */
/* LOGIN                */
/* ==================== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 30px;
  width: 100%;
  max-width: 360px;
}
.login-logo { font-family: 'Cormorant Garamond', serif; font-size: 1.9rem; font-weight: 700; color: var(--white); text-align: center; margin-bottom: 3px; }
.login-logo em { color: var(--gold); font-style: normal; }
.login-sub { text-align: center; color: var(--muted); font-size: 0.83rem; margin-bottom: 22px; }
.login-error { background: var(--danger-bg); border: 1px solid rgba(192,87,74,0.3); border-radius: 7px; padding: 9px 12px; color: var(--danger); font-size: 0.83rem; margin-bottom: 14px; }

/* ==================== */
/* DETAIL PAGE          */
/* ==================== */
.detail-grid { display: grid; grid-template-columns: 1fr 290px; gap: 16px; align-items: start; }
.detail-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.detail-card h3 { font-family: 'Cormorant Garamond', serif; font-size: 0.9rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 12px; }
.detail-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 0.84rem; gap: 10px; }
.detail-row:last-child { border-bottom: none; }
.detail-row .dl { color: var(--muted); flex-shrink: 0; }
.detail-row .dv { color: var(--text); font-weight: 500; text-align: right; }
.detail-img { width: 100%; border-radius: 7px; object-fit: cover; border: 1px solid var(--border); }

/* ==================== */
/* SCAN                 */
/* ==================== */
.scan-wrap { max-width: 460px; margin: 0 auto; text-align: center; }
#qr-reader { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.scan-result { background: var(--surface); border: 1px solid var(--gold); border-radius: var(--radius); padding: 16px; margin-top: 16px; text-align: left; }
.scan-result-code { font-family: 'Cormorant Garamond', serif; font-size: 1.9rem; color: var(--gold); font-weight: 700; }

/* ==================== */
/* LABEL                */
/* ==================== */
.label-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.label-card { background: var(--surface); border: 1px solid var(--border2); border-radius: var(--radius); padding: 11px; cursor: pointer; transition: border-color 0.2s; position: relative; }
.label-card.selected { border-color: var(--gold); }
.label-card.selected::after { content: '✓'; position: absolute; top: 9px; right: 11px; color: var(--gold); font-weight: 700; }
.label-preview { background: white; border-radius: 5px; padding: 9px; margin-bottom: 9px; text-align: center; }
.lp-code { font-family: 'Cormorant Garamond', serif; font-size: 1.2rem; font-weight: 700; color: #000; }
.lp-name { font-size: 0.62rem; color: #555; margin: 2px 0 4px; }
.lp-meta { font-size: 0.58rem; color: #777; margin-top: 2px; }

/* ==================== */
/* MODAL                */
/* ==================== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 14px 14px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-header {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal-title { font-family: 'Cormorant Garamond', serif; font-size: 1.25rem; font-weight: 600; color: var(--white); }
.modal-close { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.4rem; line-height: 1; padding: 3px 7px; transition: color 0.2s; }
.modal-close:hover { color: var(--white); }
.modal-body { padding: 16px 18px; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ==================== */
/* RIWAYAT              */
/* ==================== */
.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}
.top-pola-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}
.top-pola-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.2s;
}
.top-pola-card:hover { border-color: var(--gold); }
.top-pola-rank { font-family: 'Cormorant Garamond', serif; font-size: 1.6rem; font-weight: 700; color: var(--gold); opacity: 0.4; min-width: 24px; line-height: 1; }
.top-pola-info { flex: 1; min-width: 0; }
.top-pola-kode { font-family: 'Cormorant Garamond', serif; font-size: 1rem; color: var(--gold); font-weight: 700; }
.top-pola-nama { font-size: 0.78rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-pola-meta { font-size: 0.68rem; color: var(--muted); margin-top: 1px; }
.top-pola-count { font-family: 'Cormorant Garamond', serif; font-size: 1.2rem; font-weight: 700; color: var(--text); }

.riwayat-cards { display: flex; flex-direction: column; gap: 8px; }
.riwayat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 11px 13px; }
.riwayat-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.riwayat-kode { font-family: 'Cormorant Garamond', serif; font-size: 1rem; color: var(--gold); font-weight: 700; text-decoration: none; }
.riwayat-kode:hover { text-decoration: underline; }
.riwayat-nama { font-size: 0.82rem; color: var(--text); margin-bottom: 6px; }
.riwayat-meta { display: flex; gap: 14px; font-size: 0.73rem; color: var(--muted); flex-wrap: wrap; }
.riwayat-meta span { display: flex; align-items: center; gap: 3px; }
.riwayat-catatan { margin-top: 6px; font-size: 0.73rem; color: var(--muted); padding: 5px 8px; background: var(--surface2); border-radius: 5px; }

.hapus-riwayat-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  color: var(--muted);
  transition: all 0.2s;
  text-decoration: none;
  flex-shrink: 0;
}
.hapus-riwayat-btn:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

/* ==================== */
/* MISC                 */
/* ==================== */
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state .icon { font-size: 2rem; margin-bottom: 9px; opacity: 0.4; }
.empty-state p { font-size: 0.87rem; }

.pagination { display: flex; gap: 5px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.page-btn { padding: 6px 11px; border-radius: 6px; font-size: 0.8rem; border: 1px solid var(--border2); background: var(--surface); color: var(--text); text-decoration: none; transition: all 0.2s; }
.page-btn:hover, .page-btn.active { background: var(--gold); color: #0F0D0B; border-color: var(--gold); }

/* ==================== */
/* LIGHT MODE OVERRIDES */
/* ==================== */
[data-theme="light"] body { background: var(--bg); }
[data-theme="light"] .app-header { box-shadow: 0 1px 0 var(--border); }
[data-theme="light"] input, [data-theme="light"] select, [data-theme="light"] textarea { background: #fff; }
[data-theme="light"] .pattern-card,
[data-theme="light"] .detail-card,
[data-theme="light"] .form-card,
[data-theme="light"] .stat-card,
[data-theme="light"] .riwayat-card,
[data-theme="light"] .top-pola-card,
[data-theme="light"] .label-card,
[data-theme="light"] .table-wrap,
[data-theme="light"] .scan-result,
[data-theme="light"] .modal,
[data-theme="light"] .login-card,
[data-theme="light"] .bottom-nav { background: #fff; }
[data-theme="light"] thead { background: var(--surface2); }
[data-theme="light"] tbody tr:hover { background: var(--surface2); }
[data-theme="light"] .size-chip,
[data-theme="light"] .riwayat-catatan { background: var(--surface2); }
[data-theme="light"] .btn-outline { background: #fff; }
[data-theme="light"] .card-img-swipe { background: var(--surface2); }

/* ==================== */
/* PRINT                */
/* ==================== */
@media print {
  .app-header, .bottom-nav, .controls-bar, .page-actions, .card-actions, nav { display: none !important; }
  .print-labels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; padding: 10mm; background: white; }
  .print-label { border: 1px dashed #aaa; padding: 6px; text-align: center; page-break-inside: avoid; }
  .print-label .pl-code { font-size: 14pt; font-weight: bold; color: black; }
  .print-label .pl-name { font-size: 7pt; color: #333; margin: 2px 0; }
  .print-label .pl-meta { font-size: 6pt; color: #555; }
}

/* ======================== */
/* RESPONSIVE — MOBILE      */
/* ======================== */
@media (max-width: 768px) {
  /* Sembunyikan desktop nav, tampilkan bottom nav */
  .main-nav { display: none; }
  .bottom-nav { display: block; }

  /* Grid 2 kolom */
  .pattern-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  /* Stats 2x2 */
  .stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  /* Detail kolom tunggal */
  .detail-grid { grid-template-columns: 1fr; }

  /* Form 1 kolom */
  .form-row { grid-template-columns: 1fr; }

  /* Top pola 1 kolom */
  .top-pola-grid { grid-template-columns: 1fr; }

  .app-main { padding: 14px 10px 80px; }
  .page-head h1 { font-size: 1.5rem; }

  /* Modal dari bawah */
  .modal { border-radius: 14px 14px 0 0; }
}

@media (max-width: 360px) {
  .pattern-grid { gap: 6px; }
  .card-code { font-size: 1.1rem; }
  .card-body { padding: 3px 10px 7px; }
}
