:root {
  --lux-ink: #1b1915;
  --lux-ink-soft: #343028;
  --lux-gold: #d5a019;
  --lux-gold-bright: #f4b400;
  --lux-gold-pale: #fff4cf;
  --lux-ivory: #f7f5ef;
  --lux-paper: #fffefa;
  --lux-line: #ded7c9;
  --lux-line-soft: #ebe6dc;
  --lux-muted: #716c62;
  --lux-danger: #a9483f;
  --lux-shadow: 0 14px 36px rgba(43, 34, 17, .08);
  --lux-shadow-deep: 0 28px 80px rgba(15, 14, 11, .28);
}

html { background: var(--lux-ivory); }

body {
  background:
    radial-gradient(circle at 82% 4%, rgba(244, 180, 0, .045), transparent 25rem),
    var(--lux-ivory);
  color: var(--lux-ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, legend,
.panel h3, .section-title h3, .master-category-card strong {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--lux-ink);
  letter-spacing: -.018em;
}

button, input, select, textarea { font-family: inherit; }

input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--lux-line);
  border-radius: 9px;
  background-color: var(--lux-paper);
  color: var(--lux-ink);
  font-size: 13px;
  line-height: 1.35;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}

input, textarea { padding: 11px 13px; }

select {
  appearance: none;
  padding: 10px 42px 10px 13px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23676157' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m8 10 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 17px;
}

select:has(option[value=""]:checked) { color: #8b857a; }
select option { color: var(--lux-ink); }

textarea {
  min-height: 96px;
  line-height: 1.55;
  resize: vertical;
}

input::placeholder, textarea::placeholder { color: #aaa397; opacity: 1; }

input:hover, select:hover, textarea:hover {
  border-color: #c8ae69;
  background-color: #fffdf7;
  box-shadow: 0 0 0 3px rgba(244, 180, 0, .08);
}

input:focus, select:focus, textarea:focus,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--lux-gold);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(244, 180, 0, .14);
}

input:disabled, select:disabled, textarea:disabled {
  border-color: #e5e0d6;
  background-color: #f1efe9;
  color: #8b877e;
  box-shadow: none;
}

label {
  gap: 7px;
  color: #605b52;
  font-size: 11px;
  font-weight: 620;
  letter-spacing: .015em;
}

button {
  min-height: 42px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .005em;
}

.primary,
#loginForm button,
#recordForm button[type="submit"],
.wizard-actions .wizard-next {
  border: 1px solid #171717;
  border-bottom: 3px solid var(--lux-gold-bright);
  background: linear-gradient(180deg, #22211f, #141414);
  color: #fff;
  box-shadow: 0 7px 18px rgba(20, 18, 13, .12);
}

.primary:hover,
#loginForm button:hover,
#recordForm button[type="submit"]:hover,
.wizard-actions .wizard-next:hover {
  border-color: var(--lux-gold);
  background: linear-gradient(180deg, #342e20, #201d16);
  color: #fff;
  box-shadow: 0 9px 22px rgba(173, 125, 0, .2);
  transform: translateY(-1px);
}

/* App frame */
#app { grid-template-columns: 248px minmax(0, 1fr); }

aside {
  width: 248px;
  padding: 24px 17px 20px;
  border-right: 1px solid rgba(244, 180, 0, .13);
  background:
    radial-gradient(circle at 40% 0, rgba(244, 180, 0, .08), transparent 18rem),
    linear-gradient(180deg, #181817, #10100f 72%);
  box-shadow: 9px 0 28px rgba(20, 18, 13, .07);
}

.sidebar-logo {
  height: 98px;
  padding: 7px 12px;
  border: 1px solid rgba(213, 160, 25, .55);
  border-radius: 13px;
  background: linear-gradient(145deg, #fffdf7, #eee8da);
  box-shadow: 0 13px 30px rgba(0, 0, 0, .23), inset 0 1px 0 #fff;
}

.sidebar-logo img { width: 150px; }
.sidebar-logo span { color: #675225; font-weight: 700; }

nav { margin-top: 28px; }

nav button, #logout {
  min-height: 43px;
  margin: 2px 0;
  padding: 0 15px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  border-radius: 8px;
  color: #c9c5bb;
  font-size: 13px;
  font-weight: 550;
}

nav button.active,
nav button:hover,
#logout:hover {
  border-left-color: var(--lux-gold-bright);
  background: linear-gradient(90deg, rgba(244, 180, 0, .16), rgba(244, 180, 0, .055));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(244, 180, 0, .08);
}

main { min-width: 0; }

header {
  height: 102px;
  padding: 0 34px;
  gap: 18px;
  border-bottom: 1px solid var(--lux-line-soft);
  background: rgba(255, 254, 250, .94);
  box-shadow: 0 3px 16px rgba(43, 34, 17, .025);
}

header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 500;
}

header p { margin: 5px 0 0; color: var(--lux-muted); font-size: 12px; }

header label {
  min-width: 126px;
  margin: 0;
  color: var(--lux-muted);
  font-size: 10px;
  font-weight: 650;
}

header input { min-height: 38px; padding: 7px 10px; background: #fff; }

#content { padding: 28px 34px 42px; }

/* Content cards and tables */
.stat, .panel, .table, .master-category-card {
  border-color: var(--lux-line-soft);
  background: rgba(255, 254, 250, .98);
  box-shadow: var(--lux-shadow);
}

.stat, .panel, .table { border-radius: 14px; }

.tools {
  min-height: 48px;
  margin-bottom: 14px;
}

.tools p { margin: 0; color: var(--lux-muted); font-size: 12px; }
.tools .primary, .section-title .primary { min-width: 112px; padding-inline: 18px; }

.section-title { margin-bottom: 14px; }
.section-title.records-title { margin-top: 28px; }
.section-title h3 { font-size: 23px; font-weight: 500; }
.section-title p { color: var(--lux-muted); font-size: 11px; }

.table {
  border: 1px solid var(--lux-line-soft);
  overflow: auto;
}

table { min-width: 820px; }

th, td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--lux-line-soft);
  vertical-align: middle;
}

th {
  background: linear-gradient(180deg, #fbfaf6, #f7f5ef);
  color: #6e685d;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .075em;
  text-transform: uppercase;
  white-space: nowrap;
}

td { color: #302d27; font-size: 12px; line-height: 1.42; }
tbody tr { transition: background-color .16s ease; }
tbody tr:hover { background: #fffbef; }
tbody tr:last-child td { border-bottom: 0; }
td small { display: block; margin-top: 4px; color: var(--lux-muted); }

.badge, .employee-status {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border: 1px solid rgba(213, 160, 25, .18);
  border-radius: 999px;
  background: var(--lux-gold-pale);
  color: #725500;
  font-size: 10px;
  font-weight: 750;
  line-height: 1;
  text-transform: capitalize;
}

.empty { padding: 56px 20px !important; color: #8b857a; }

.master-category-cards { gap: 14px; }

.master-category-card {
  min-height: 168px;
  padding: 20px;
  border: 1px solid var(--lux-line-soft);
  border-top: 2px solid transparent;
  border-left: 1px solid var(--lux-line-soft);
  border-radius: 14px;
}

.master-category-card:hover,
.master-category-card.active {
  border-color: var(--lux-gold);
  border-top-color: var(--lux-gold-bright);
  border-left-color: var(--lux-gold);
  background: linear-gradient(145deg, #fffefa, #fffaf0);
  box-shadow: 0 16px 34px rgba(75, 55, 10, .12);
  transform: translateY(-3px);
}

.master-category-card span { color: #906b00; font-size: 9px; letter-spacing: .16em; }
.master-category-card strong { margin-top: 10px; font-size: 20px; font-weight: 500; }
.master-category-card small { color: var(--lux-muted); }

/* Modal shell */
dialog {
  width: min(820px, calc(100vw - 36px));
  max-height: min(92vh, 900px);
  border: 1px solid rgba(213, 160, 25, .25);
  border-top: 3px solid var(--lux-gold-bright);
  border-radius: 17px;
  background: var(--lux-paper);
  box-shadow: var(--lux-shadow-deep);
  overflow: hidden;
}

dialog[open] { animation: luxuryDialogIn .18s ease-out; }

@keyframes luxuryDialogIn {
  from { opacity: 0; transform: translateY(8px) scale(.988); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

dialog::backdrop {
  background: rgba(22, 28, 24, .62);
  backdrop-filter: blur(5px);
}

/* Notifications must remain readable above native dialogs and custom overlays. */
#toast { z-index: 30000; max-width: min(440px, calc(100vw - 32px)); box-shadow: 0 14px 38px rgba(0,0,0,.28); }
[data-sales-record] { cursor: pointer; }
[data-sales-record]:focus-visible { outline: 2px solid var(--lux-gold-bright); outline-offset: -2px; }

.dialogHead {
  min-height: 108px;
  align-items: center;
  padding: 22px 28px;
  border-bottom: 1px solid var(--lux-line-soft);
  background: linear-gradient(180deg, #fffefa, #fcfaf5);
}

.dialogHead small {
  color: #966f00;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .22em;
}

.dialogHead h2 {
  margin: 7px 0 0;
  font-size: 31px;
  font-weight: 500;
  line-height: 1.08;
}

.dialogHead > button {
  display: grid;
  place-items: center;
  width: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid var(--lux-line-soft);
  border-radius: 11px;
  background: #fff;
  color: #292620;
  font-size: 24px;
  font-weight: 400;
  box-shadow: 0 4px 12px rgba(32, 27, 16, .05);
}

.dialogHead > button:hover {
  border-color: var(--lux-gold);
  background: var(--lux-gold-pale);
  color: #644b00;
  box-shadow: 0 5px 15px rgba(155, 112, 0, .12);
  transform: none;
}

#recordForm {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 20px;
  max-height: calc(min(92vh, 900px) - 108px);
  padding: 24px 28px 28px;
  background: var(--lux-paper);
  scrollbar-color: #c4baa6 transparent;
  scrollbar-width: thin;
}

#recordForm label { margin: 8px 0; }

#recordForm > button[type="submit"] {
  min-height: 45px;
  margin-top: 15px;
}

.master-warning {
  margin-bottom: 16px;
  padding: 13px 15px;
  border-color: #e3b632;
  border-left-width: 3px;
  border-radius: 10px;
  background: linear-gradient(90deg, #fff4cf, #fff9e9);
  color: #5b470c;
  box-shadow: 0 4px 13px rgba(180, 128, 0, .06);
}

.wizard-progress {
  gap: 9px;
  margin: 1px 0 20px;
}

.wizard-progress span {
  height: 4px;
  border-radius: 99px;
  background: #e6e0d4;
}

.wizard-progress span.active {
  background: linear-gradient(90deg, #c58d00, var(--lux-gold-bright));
  box-shadow: 0 1px 5px rgba(213, 160, 25, .18);
}

.wizard-step { gap: 0 18px; }

.wizard-step legend {
  margin-bottom: 10px;
  padding: 0 0 11px;
  border-bottom: 1px solid var(--lux-line-soft);
  font-size: 22px;
  font-weight: 500;
}

.wizard-actions {
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--lux-line-soft);
}

.wizard-actions button { min-height: 43px; padding: 10px 23px; }

.wizard-actions .wizard-back {
  border: 1px solid var(--lux-line);
  background: #fff;
  color: var(--lux-ink-soft);
  box-shadow: 0 4px 12px rgba(40, 34, 21, .04);
}

.wizard-actions .wizard-back:hover {
  border-color: #b89332;
  background: #fffaf0;
  color: #5b470c;
}

.form-note {
  grid-column: 1 / -1;
  margin: 12px 0 0;
  padding: 11px 13px;
  border-radius: 8px;
  background: #f6f3eb;
  color: var(--lux-muted);
  font-size: 11px;
}

/* Sale choice */
#recordForm[data-kind="sale"] {
  gap: 0;
  padding: 27px 30px 30px;
}

.sale-choice-intro {
  padding: 5px 0 13px;
  color: #2f2b23;
  font-size: 24px;
  font-weight: 500;
}

#recordForm[data-kind="sale"] label {
  gap: 8px;
  margin: 8px 0;
  color: #625d54;
  font-size: 11px;
  font-weight: 700;
}

#recordForm[data-kind="sale"] select {
  min-height: 48px;
  padding: 10px 44px 10px 14px;
  border: 1px solid var(--lux-line);
  border-radius: 9px;
  background-color: var(--lux-paper);
  color: var(--lux-ink);
  font-size: 13px;
  font-weight: 600;
}

#recordForm[data-kind="sale"] > button[type="submit"] {
  min-height: 45px;
  margin-top: 8px;
}

/* Employee and detail cards */
.employee-type-choice { padding: 11px 2px 16px; }
.employee-type-choice h3 { font-size: 24px; font-weight: 500; }
.employee-type-choice p { margin: 7px 0 18px; }
.employee-type-choice > div { gap: 14px; }

.employee-type-card {
  border-color: var(--lux-line-soft);
  border-radius: 12px;
  box-shadow: 0 6px 17px rgba(44, 36, 20, .05);
}

.employee-type-card:hover {
  border-color: var(--lux-gold);
  background: linear-gradient(145deg, #fffefa, #fff9e9);
  box-shadow: 0 13px 28px rgba(112, 81, 8, .12);
  transform: translateY(-2px);
}

.ctc-group, .employee-detail-section {
  border-color: var(--lux-line-soft);
  border-radius: 12px;
  box-shadow: 0 6px 17px rgba(44, 36, 20, .04);
}

.ctc-group h4, .employee-detail-section h3 {
  border-bottom-color: var(--lux-gold);
  font-weight: 500;
}

.employee-row-actions button {
  border-color: var(--lux-line);
  border-radius: 8px;
  background: #fffefa;
}

#toast {
  z-index: 20000;
  right: 24px;
  top: 112px;
  min-width: 220px;
  padding: 13px 17px;
  border: 1px solid rgba(244, 180, 0, .35);
  border-left: 3px solid var(--lux-gold-bright);
  border-radius: 10px;
  background: #1b1a17;
  box-shadow: 0 14px 35px rgba(0, 0, 0, .2);
  color: #fff;
  font-size: 12px;
}

#privacyModeBanner {
  position: fixed;
  right: 20px;
  bottom: 18px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border: 1px solid rgba(244, 180, 0, .45);
  border-left: 3px solid var(--lux-gold-bright);
  border-radius: 10px;
  background: rgba(24, 23, 20, .96);
  color: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .2);
  font-size: 10px;
  pointer-events: none;
}

#privacyModeBanner strong { color: #ffd35b; letter-spacing: .08em; }
#privacyModeBanner span { color: #d5d0c6; }

@media (max-width: 1000px) {
  #app { grid-template-columns: 220px minmax(0, 1fr); }
  aside { width: 220px; }
  header, #content { padding-left: 25px; padding-right: 25px; }
  .master-category-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  #app { display: block; }
  aside {
    position: relative;
    width: 100%;
    height: auto;
    padding: 14px;
  }
  .sidebar-logo { width: 180px; height: 74px; }
  nav { display: flex; gap: 5px; margin-top: 13px; padding-bottom: 2px; overflow-x: auto; }
  nav button { flex: 0 0 auto; width: auto; min-height: 39px; padding-inline: 14px; white-space: nowrap; }
  #logout { width: auto; margin-top: 8px; }
  header { min-height: 88px; height: auto; padding: 18px 20px; }
  header h1 { font-size: 25px; }
  #content { padding: 22px 18px 36px; }
  dialog { width: min(760px, calc(100vw - 22px)); border-radius: 14px; }
  .dialogHead { min-height: 94px; padding: 19px 21px; }
  .dialogHead h2 { font-size: 28px; }
  #recordForm { padding: 21px; }
}

@media (max-width: 650px) {
  .master-category-cards { grid-template-columns: 1fr; }
  .master-category-card { min-height: 145px; }
  #recordForm { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .wizard-step { grid-template-columns: minmax(0, 1fr); }
  .dialogHead h2 { font-size: 25px; }
  .sale-choice-intro { font-size: 21px; }
  .wizard-step legend { font-size: 20px; }
  .tools, .section-title { align-items: flex-end; gap: 12px; }
  .tools .primary, .section-title .primary { min-width: 104px; }
  #privacyModeBanner { right: 10px; bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
