:root {
  --bg: #0a0a0a;
  --bg-elev: #141414;
  --bg-row: #111;
  --bg-row-alt: #171717;
  --bg-input: #0d0d0d;
  --border: #2a2a2a;
  --border-strong: #3a3a3a;
  --text: #f5f5f5;
  --muted: #9a9a9a;
  --red: #e10600;
  --red-dark: #b00000;
  --red-soft: rgba(225, 6, 0, 0.14);
  --white: #ffffff;
  --focus: #e10600;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Consolas", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(225, 6, 0, 0.18), transparent 55%),
    radial-gradient(900px 400px at 100% 0%, rgba(255, 255, 255, 0.05), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.35;
}

a {
  color: var(--white);
  text-decoration: none;
}

a:hover {
  color: var(--red);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(10px);
  background: rgba(10, 10, 10, 0.92);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.4rem 1rem;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--white);
  min-width: 0;
  flex-shrink: 0;
}

.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 7px;
  background: var(--red);
  color: var(--white);
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 0.85rem;
}

.topbar .logo-mark {
  width: 1.7rem;
  height: 1.7rem;
  font-size: 0.68rem;
  border-radius: 5px;
  flex-shrink: 0;
}

.brand-text {
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 0.95rem;
  white-space: nowrap;
}

.brand-text em {
  font-style: normal;
  color: var(--red);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar .btn {
  min-height: 34px;
  padding: 0.28rem 0.8rem;
  font-size: 0.85rem;
  border-radius: 7px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  max-width: 10rem;
  min-height: 34px;
  font-size: 0.8rem;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.45rem 1rem 1rem;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem 0.85rem;
  align-items: center;
  margin-bottom: 0.45rem;
  flex-wrap: wrap;
}

.toolbar h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.toolbar .muted {
  margin-top: 0.12rem;
}

.toolbar-right {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-box {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.filter-box input,
.auth-form input,
.sheet input {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 0.35rem 0.65rem;
  font: inherit;
  outline: none;
  min-height: 34px;
}

.filter-box input {
  min-width: min(100%, 260px);
  width: 260px;
}

.filter-box input:focus,
.auth-form input:focus,
.sheet input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0.32rem 0.75rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: 0.15s ease;
  min-height: 34px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.btn-primary {
  background: var(--red);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--red-dark);
  color: var(--white);
}

.btn-danger {
  background: transparent;
  border-color: var(--red);
  color: var(--red);
}

.btn-danger:hover {
  background: var(--red);
  color: var(--white);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--white);
}

.btn-ghost:hover {
  border-color: var(--white);
}

.btn-icon {
  padding: 0.4rem 0.65rem;
  min-height: 34px;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

.sheet-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sheet-scroll {
  overflow: auto;
  max-height: calc(100vh - 132px);
}

.sheet {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 760px;
  font-variant-numeric: tabular-nums;
}

.sheet th,
.sheet td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 0;
  vertical-align: middle;
}

.sheet th:last-child,
.sheet td:last-child {
  border-right: none;
}

.sheet thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #1a1a1a;
  color: var(--white);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.6rem;
  text-align: left;
  border-bottom: 2px solid var(--red);
}

.sheet tbody tr {
  background: var(--bg-row);
}

.sheet tbody tr:nth-child(even) {
  background: var(--bg-row-alt);
}

.sheet tbody tr:hover {
  background: #1d1212;
}

.sheet tbody tr.is-hit {
  background: #1d1010;
}

.sheet tbody tr.is-picked {
  background: #2a1414;
  outline: 1px solid var(--red);
}

.sheet tbody tr.is-picked:nth-child(even) {
  background: #321818;
}

mark.hl {
  background: var(--red);
  color: var(--white);
  padding: 0 0.15em;
  border-radius: 3px;
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 100;
  max-width: min(420px, calc(100vw - 2rem));
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-weight: 600;
  line-height: 1.35;
}

.toast-success {
  background: #102010;
  border-color: #2e7d32;
  color: #b9f6ca;
}

.toast-warn {
  background: #2a2208;
  border-color: #c9a227;
  color: #ffe082;
}

.toast-error {
  background: #2a1010;
  border-color: var(--red);
  color: #ffb4b0;
}

.type-preview {
  display: none;
}

.type-text {
  font-weight: 550;
}

.import-hint {
  margin: -0.15rem 0 0.5rem;
  font-size: 0.78rem;
}

.import-hint code {
  background: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  color: #ffd7d5;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.file-btn {
  cursor: pointer;
  margin: 0;
}

.sheet .cell {
  padding: 0.32rem 0.55rem;
  min-height: 32px;
}

.sheet input {
  width: 100%;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0.32rem 0.55rem;
  min-height: 32px;
}

.sheet input:focus {
  background: #1a0a0a;
  box-shadow: inset 0 0 0 2px var(--red);
}

.sheet .col-row {
  width: 56px;
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.sheet .col-brand {
  width: 140px;
}

.sheet .col-qnt {
  width: 110px;
}

.sheet .col-harga {
  width: 170px;
}

.sheet .col-check {
  width: 44px;
  text-align: center;
}

.sheet .col-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--red);
  cursor: pointer;
}

.sheet thead .col-check {
  padding: 0.4rem 0.4rem;
}

.sheet td.col-check .cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
}

#btnBulkDelete:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sheet .col-aksi {
  width: 150px;
}

.sheet td.col-row .cell,
.sheet td.col-aksi .cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: 32px;
}

.sheet .harga-display {
  font-family: var(--mono);
  font-size: 0.92rem;
}

.sheet-public td {
  padding: 0.38rem 0.6rem;
}

.sheet-public .col-brand,
.sheet-public .col-type {
  font-weight: 550;
}

.sheet-public .col-harga {
  font-family: var(--mono);
  font-size: 0.92rem;
  white-space: nowrap;
}

.sheet-status {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 0.7rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
  background: #101010;
}

.status-msg {
  color: var(--red);
}

.empty-row td,
.loading-row td {
  padding: 1.1rem 0.75rem;
  text-align: center;
  color: var(--muted);
  border-right: none;
}

/* Auth */
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.auth-card {
  width: min(100%, 420px);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem;
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}

.auth-brand h1 {
  margin: 0;
  font-size: 1.25rem;
}

.auth-brand p {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-form input {
  min-height: 40px;
  padding: 0.5rem 0.75rem;
}

.auth-form {
  display: grid;
  gap: 0.85rem;
}

.auth-form label {
  display: grid;
  gap: 0.35rem;
}

.auth-form label span {
  font-size: 0.85rem;
  color: var(--muted);
}

.auth-foot {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.9rem;
}

.alert {
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  margin-bottom: 0.9rem;
  font-size: 0.92rem;
}

.alert-error {
  background: var(--red-soft);
  border: 1px solid var(--red);
  color: #ffb4b0;
}

@media (max-width: 720px) {
  .toolbar {
    align-items: stretch;
  }

  .toolbar-right,
  .filter-box {
    width: 100%;
  }

  .filter-box input,
  #btnAdd {
    width: 100%;
    min-width: 0;
  }

  .sheet-scroll {
    max-height: calc(100vh - 168px);
  }

  .sheet {
    min-width: 680px;
  }

  .topbar-inner {
    padding: 0.3rem 0.75rem;
    min-height: 44px;
    gap: 0.5rem;
  }

  .brand-text {
    font-size: 0.88rem;
  }

  .topbar .btn {
    min-height: 32px;
    padding: 0.22rem 0.65rem;
    font-size: 0.8rem;
  }

  .user-chip {
    min-height: 32px;
    max-width: 7rem;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
  }
}
