* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-hover: #f5f5f5;
  --border: #e5e5e5;
  --border-light: #f0f0f0;
  --text: #171717;
  --text-secondary: #525252;
  --text-muted: #a3a3a3;
  --brand: #0ea5e9;
  --brand-hover: #0284c7;
  --brand-light: #f0f9ff;
  --brand-ghost: #f8fbff;
  --brand-ring: rgba(14, 165, 233, 0.2);
  --success: #10b981;
  --success-light: #ecfdf5;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-md: 12px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.04);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden { display: none !important; }

/* === Login === */
.login-container {
  display: flex; justify-content: center; align-items: center; min-height: 100vh;
  background: var(--bg);
}
.login-card {
  background: var(--surface); padding: 40px 32px; border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 400px; border: 1px solid var(--border);
}
.login-card h1 {
  text-align: center; margin-bottom: 6px; color: var(--text);
  font-size: 22px; font-weight: 700; letter-spacing: -0.3px;
}
.login-card .subtitle {
  display: block; text-align: center; color: var(--text-muted);
  margin-bottom: 28px; font-size: 14px;
}

/* === Forms === */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; margin-bottom: 5px; font-weight: 600; font-size: 13px;
  color: var(--text-secondary);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text);
  background: var(--surface); font-family: inherit; transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring);
}
.form-group textarea { resize: vertical; min-height: 60px; }

::placeholder { color: var(--text-muted); }

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border: none; border-radius: var(--radius-sm); font-size: 14px;
  font-weight: 600; cursor: pointer; font-family: inherit; transition: all 0.15s;
  white-space: nowrap; line-height: 1;
}
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-hover); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 4px 9px; font-size: 12px; }

/* === App Layout === */
.app-container { display: flex; flex-direction: column; min-height: 100vh; }
.app-body { display: flex; flex: 1; overflow: hidden; }

/* === Topbar === */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 22px; height: 52px; display: flex; justify-content: space-between;
  align-items: center; z-index: 50; flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-left h2 { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -0.2px; }
.topbar-left .btn-toggle {
  background: none; border: none; color: var(--text-secondary); cursor: pointer;
  font-size: 18px; padding: 6px; border-radius: var(--radius-sm); line-height: 1;
  transition: all 0.12s; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
}
.topbar-left .btn-toggle:hover { background: var(--surface-hover); color: var(--text); }
.topbar .user-info { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-secondary); }
.topbar .role-badge {
  background: var(--brand-light); color: var(--brand-hover); padding: 2px 9px;
  border-radius: 16px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
}
.topbar .btn-logout {
  background: var(--surface-hover); color: var(--text-secondary); padding: 6px 14px;
  border-radius: var(--radius-sm); border: none; cursor: pointer; font-size: 13px;
  font-weight: 600; font-family: inherit; transition: all 0.12s;
}
.topbar .btn-logout:hover { background: var(--danger-light); color: var(--danger); }

/* === Sidebar === */
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; width: 220px; min-width: 220px;
  transition: width 0.2s ease, min-width 0.2s ease; overflow: hidden; flex-shrink: 0;
  padding: 10px 8px;
}
.sidebar.collapsed { width: 52px; min-width: 52px; }
.sidebar .nav-section {
  padding: 8px 12px 4px; font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; overflow: hidden;
}
.sidebar.collapsed .nav-section { opacity: 0; }
.sidebar .nav-btn {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: none; border: none; cursor: pointer; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); transition: all 0.1s; white-space: nowrap; overflow: hidden;
  font-family: inherit; text-align: left; width: 100%; border-radius: var(--radius-sm);
  margin-bottom: 1px;
}
.sidebar .nav-btn .nav-icon { font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar .nav-btn .nav-label { transition: opacity 0.12s; }
.sidebar.collapsed .nav-btn .nav-label { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .nav-btn { justify-content: center; padding: 8px 0; gap: 0; }
.sidebar .nav-btn:hover { background: var(--surface-hover); color: var(--text); }
.sidebar .nav-btn.active { background: var(--brand-light); color: var(--brand-hover); font-weight: 600; }

.content { flex: 1; padding: 24px; overflow-y: auto; }

/* === Tables === */
.data-table {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-xs);
  border: 1px solid var(--border);
}
.data-table th, .data-table td { padding: 10px 14px; text-align: left; font-size: 13px; }
.data-table th {
  background: var(--bg); font-weight: 600; color: var(--text-secondary);
  font-size: 12px; border-bottom: 1px solid var(--border);
}
.data-table td { border-bottom: 1px solid var(--border-light); color: var(--text); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--brand-ghost); }
.data-table .actions { display: flex; gap: 5px; }

/* === Cards === */
.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-xs);
  padding: 20px; margin-bottom: 14px; border: 1px solid var(--border);
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-header h3 { font-size: 15px; font-weight: 700; color: var(--text); }

/* === Kasir Layout === */
.kasir-container { display: flex; flex-direction: column; flex: 1; height: calc(100vh - 76px); }
.tab-bar {
  display: flex; background: var(--surface); border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden; border: 1px solid var(--border); border-bottom: none;
}
.tab-btn {
  flex: 1; padding: 10px 8px; background: var(--bg); border: none;
  border-bottom: 2px solid transparent; cursor: pointer; font-size: 13px;
  font-weight: 600; color: var(--text-secondary); transition: all 0.12s; font-family: inherit;
}
.tab-btn:hover { background: var(--surface-hover); color: var(--text); }
.tab-btn.active { background: var(--surface); color: var(--brand); border-bottom-color: var(--brand); }
.tab-btn input {
  border: none; background: transparent; text-align: center; font-weight: 600;
  font-size: 13px; color: inherit; width: 100%; outline: none; font-family: inherit;
}
.tab-content {
  flex: 1; background: var(--surface); border-radius: 0 0 var(--radius) var(--radius);
  padding: 20px; display: none; overflow: auto; border: 1px solid var(--border); border-top: none;
}
.tab-content.active { display: flex; }
.tab-panel { display: flex; gap: 20px; width: 100%; }
.tab-left { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.tab-right { width: 280px; border-left: 1px solid var(--border); padding-left: 20px; overflow-y: auto; }
.tab-bottom {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 0 0;
  border-top: 1px solid var(--border); margin-top: auto;
}
.tab-bottom .total-label { font-size: 18px; font-weight: 700; color: var(--brand); }

.customer-input {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text); background: var(--surface); font-family: inherit;
  width: 200px; transition: border-color 0.15s, box-shadow 0.15s;
}
.customer-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.customer-input[readonly] { background: var(--bg); }

.item-list { flex: 1; overflow-y: auto; min-height: 0; }
.item-row {
  display: flex; justify-content: space-between; align-items: center; padding: 10px 12px;
  background: var(--bg); border-radius: var(--radius-sm); margin-bottom: 4px;
  border: 1px solid transparent; transition: all 0.12s;
}
.item-row:hover { border-color: var(--border); background: var(--surface); }
.item-row .item-info { flex: 1; min-width: 0; }
.item-row .item-name { font-weight: 600; font-size: 14px; }
.item-row .item-meta { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.item-row .item-price { font-weight: 700; color: var(--brand); font-size: 14px; }
.item-row .btn-remove {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 16px; padding: 2px 6px; border-radius: 4px; transition: all 0.1s; line-height: 1;
}
.item-row .btn-remove:hover { color: var(--danger); background: var(--danger-light); }
.package-items { margin-left: 14px; font-size: 12px; color: var(--text-muted); }
.package-items span { display: block; }

.service-grid { display: flex; flex-direction: column; gap: 3px; }
.service-card {
  display: flex; justify-content: space-between; align-items: center; padding: 9px 12px;
  background: var(--bg); border-radius: var(--radius-sm); transition: all 0.12s; cursor: default;
}
.service-card:hover { background: var(--brand-ghost); }
.service-card .svc-info { flex: 1; min-width: 0; }
.service-card .svc-name { font-weight: 600; font-size: 13px; }
.service-card .svc-price { font-size: 12px; color: var(--brand); font-weight: 700; }
.service-card .btn-beli {
  padding: 5px 14px; background: var(--brand); color: #fff; border: none;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; font-weight: 600;
  font-family: inherit; transition: all 0.1s;
}
.service-card .btn-beli:hover { background: var(--brand-hover); }
.service-card .btn-beli:active { transform: scale(0.97); }

/* === Modal === */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.35); display: flex; justify-content: center; align-items: center;
  z-index: 1000; backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface); border-radius: var(--radius-md); padding: 26px;
  width: 100%; max-width: 460px; max-height: 82vh; overflow-y: auto;
  box-shadow: var(--shadow-xl); border: 1px solid var(--border);
}
.modal h3 { margin-bottom: 18px; color: var(--text); font-size: 17px; font-weight: 700; letter-spacing: -0.2px; }
.modal .modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 22px; }
.modal-wide { max-width: 600px; }

/* === Summary === */
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin-bottom: 16px; }
.summary-grid .label { font-size: 12px; color: var(--text-muted); }
.summary-grid .value { font-size: 15px; font-weight: 700; }

/* === Settings tabs === */
.settings-tabs {
  display: flex; gap: 3px; margin-bottom: 20px; background: var(--surface);
  border-radius: var(--radius); padding: 3px; border: 1px solid var(--border);
}
.settings-tab {
  padding: 8px 18px; border: none; background: transparent; cursor: pointer;
  border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--text-secondary);
  transition: all 0.1s; font-family: inherit;
}
.settings-tab.active { background: var(--brand); color: #fff; }
.settings-tab:hover:not(.active) { background: var(--surface-hover); color: var(--text); }

/* === Form row === */
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-inline { display: inline-flex; align-items: end; gap: 8px; }

/* === Report === */
.report-summary { display: flex; gap: 14px; margin-top: 20px; flex-wrap: wrap; }
.report-summary .summary-card {
  background: var(--surface); padding: 16px 20px; border-radius: var(--radius);
  border: 1px solid var(--border); min-width: 130px;
}
.report-summary .summary-card .sc-label {
  font-size: 11px; color: var(--text-muted); margin-bottom: 3px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.report-summary .summary-card .sc-value { font-size: 24px; font-weight: 700; color: var(--brand); }

/* === Expandable === */
.expand-row { cursor: pointer; }
.expand-row:hover td { background: var(--brand-ghost); }
.expand-detail { background: var(--bg); }
.expand-detail td { padding: 8px 14px; font-size: 13px; color: var(--text-secondary); }

/* === Checkbox === */
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.checkbox-label input[type="checkbox"] { width: auto; accent-color: var(--brand); }

/* === Empty state === */
.empty-state { text-align: center; padding: 44px 20px; color: var(--text-muted); font-size: 14px; }

/* === Alert === */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 13px; font-weight: 500; }
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(239,68,68,0.15); }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid rgba(16,185,129,0.15); }

/* === Date row === */
.date-row { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.date-row input[type="date"] {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text); font-family: inherit;
}
.date-row input[type="date"]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.date-row label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }

/* === Scrollbar === */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.18); }

/* === Utilities === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 13px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
