/* ===================== FONTS ===================== */
@font-face {
  font-family: "Nikosh";
  src: local("Nikosh"), local("NikoshBAN");
}

/* ===================== CUSTOM PROPERTIES ===================== */
:root {
  /* Maritime Palette */
  --bg-base: #05080f;
  --bg-surface: #090d1a;
  --bg-card: #0d1220;
  --bg-elevated: #111828;
  --bg-hover: #1a2236;
  --bg-active: #1e2d42;

  /* Gold System */
  --gold: #d4a574;
  --gold2: #e8c090;
  --gold3: #f5d9b2;
  --gold-dim: #8b6f47;
  --gold-dark: #5a4020;
  --gold-glow: rgba(212, 165, 116, 0.13);
  --gold-border: rgba(212, 165, 116, 0.18);
  --gold-border-active: rgba(212, 165, 116, 0.45);

  /* Accent Blue */
  --blue: #4a90e2;
  --blue-glow: rgba(74, 144, 226, 0.12);

  /* Status */
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #38bdf8;

  /* Text */
  --white: #ffffff;
  --text: #ffffff;
  --text-secondary: #cccccc;
  --muted: #aaaaaa;

  /* Borders */
  --border: rgba(212, 165, 116, 0.09);
  --border-light: rgba(212, 165, 116, 0.18);
  --border-focus: rgba(212, 165, 116, 0.4);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.55);
  --shadow-xl: 0 24px 80px rgba(0, 0, 0, 0.65);
  --glow-gold: 0 0 24px rgba(212, 165, 116, 0.15);

  /* Radius */
  --r-xs: 4px;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Transitions */
  --t: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: all 0.15s ease;

  /* Layout */
  --sidebar-w: 260px;
  --topbar-h: 64px;

  /* Type Scale */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 20px;
  --text-xl: 24px;
  --text-2xl: 31px;
  --text-3xl: 39px;
}

/* ===================== RESET ===================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

button {
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
  font-family: inherit;
}

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

a {
  text-decoration: none;
  color: inherit;
}

/* ===================== BASE ===================== */
body {
  font-family: "Nikosh", "Times New Roman", serif;
  background: var(--bg-base);
  color: var(--text);
  font-size: var(--text-base);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ambient background radiance */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 12% 55%, rgba(212, 165, 116, 0.045) 0%, transparent 52%),
    radial-gradient(ellipse at 88% 12%, rgba(74, 144, 226, 0.03) 0%, transparent 52%),
    radial-gradient(ellipse at 55% 92%, rgba(212, 165, 116, 0.028) 0%, transparent 48%);
  pointer-events: none;
  z-index: 0;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--gold-dim);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

/* ===================== LAYOUT ===================== */
.layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow: hidden;
}

/* Shimmer edge */
.sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg,
      transparent 0%,
      rgba(212, 165, 116, 0.1) 15%,
      rgba(212, 165, 116, 0.35) 40%,
      rgba(212, 165, 116, 0.5) 50%,
      rgba(212, 165, 116, 0.35) 60%,
      rgba(212, 165, 116, 0.1) 85%,
      transparent 100%);
}

/* Brand */
.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  flex-shrink: 0;
  position: relative;
  background: linear-gradient(180deg, rgba(212, 165, 116, 0.04) 0%, transparent 100%);
}

.brand-icon {
  width: 54px;
  height: 54px;
  background: linear-gradient(145deg, var(--gold-dark), var(--gold-dim), var(--gold));
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 6px 20px rgba(212, 165, 116, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-icon::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -60%;
  width: 220%;
  height: 220%;
  background: linear-gradient(45deg,
      transparent 35%,
      rgba(255, 255, 255, 0.15) 50%,
      transparent 65%);
  animation: brandShimmer 4s ease-in-out infinite;
}

@keyframes brandShimmer {

  0%,
  100% {
    transform: translateX(-120%) rotate(0deg);
  }

  50% {
    transform: translateX(120%) rotate(0deg);
  }
}

.brand-title {
  color: var(--gold2);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.015em;
  line-height: 1.45;
}

.brand-sub {
  color: var(--muted);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
}

/* Navigation */
.nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav::-webkit-scrollbar {
  width: 2px;
}

.nav-group-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 14px 10px 6px;
  white-space: nowrap;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-group-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
  border-radius: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: var(--t);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 3px;
  border: 1px solid transparent;
  letter-spacing: 0.025em;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--white);
  border-color: var(--gold-border);
  box-shadow: inset 3px 0 0 var(--gold-dim);
}

.nav-item:hover .ni {
  background: rgba(212, 165, 116, 0.1);
  border-color: var(--gold-border);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.13), rgba(212, 165, 116, 0.05));
  color: var(--gold2);
  border-color: var(--gold-border);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(212, 165, 116, 0.07);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 56%;
  background: linear-gradient(180deg, var(--gold3), var(--gold));
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 10px rgba(212, 165, 116, 0.5);
}

.nav-item.active .ni {
  background: rgba(212, 165, 116, 0.14);
  border-color: rgba(212, 165, 116, 0.35);
  box-shadow: 0 0 8px rgba(212, 165, 116, 0.15);
}

.ni {
  width: 28px;
  height: 28px;
  border-radius: var(--r-xs);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: var(--t);
}

.sidebar-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.9;
  text-align: center;
  flex-shrink: 0;
}

/* ===================== MAIN ===================== */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===================== TOPBAR ===================== */
.topbar {
  height: var(--topbar-h);
  background: rgba(9, 13, 26, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.topbar-sub {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: 1px;
}

.topbar-clock {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 6px 13px;
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.topbar-clock strong {
  color: var(--gold);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
}

#fbStatus {
  display: flex;
  align-items: center;
  font-size: 12px;
}

#adminBadge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #dc2626;
  border: 1px solid #991b1b;
  color: #ffffff;
  padding: 5px 12px;
  border-radius: var(--r);
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  transition: var(--t);
  letter-spacing: 0.03em;
}

#adminBadge:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.4);
}

/* ===================== PAGE ===================== */
.page {
  flex: 1;
  padding: 24px;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: viewFade 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes viewFade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================== STATS ===================== */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 20px 18px;
  position: relative;
  overflow: hidden;
  transition: var(--t);
  cursor: default;
}

.stat:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--glow-gold);
}

.stat::before {
  content: "";
  position: absolute;
  top: -20px;
  right: -20px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--gold-glow);
  pointer-events: none;
}

.stat::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat:hover::after {
  opacity: 1;
}

.stat-ico {
  font-size: 26px;
  margin-bottom: 12px;
  display: block;
  line-height: 1;
}

.stat-num {
  font-size: 30px;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.stat-lbl {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ===================== CARDS ===================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 20px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, rgba(212, 165, 116, 0.025) 0%, transparent 100%);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
}

.card-sub {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.02em;
}

/* ===================== DATA TABLES ===================== */
.tbl-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 520px;
  -webkit-overflow-scrolling: touch;
}

table.dt {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

table.dt thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

table.dt th {
  background: var(--bg-elevated);
  color: var(--muted);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.dt td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(212, 165, 116, 0.045);
  color: var(--text);
  vertical-align: middle;
  transition: background 0.12s ease;
}

table.dt tbody tr:last-child td {
  border-bottom: none;
}

table.dt tbody tr:hover td {
  background: var(--bg-hover);
}

/* ===================== OT TABLE ===================== */
.ot-wrap {
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
  margin: 0 22px 0;
  border-radius: var(--r);
  border: 1px solid var(--border);
}

.ot-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.ot-tbl thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.ot-tbl th {
  background: var(--bg-elevated);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.ot-tbl td {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(212, 165, 116, 0.04);
  vertical-align: middle;
  color: var(--text);
  font-size: var(--text-sm);
  transition: background 0.1s ease;
}

.ot-tbl tbody tr:hover td {
  background: rgba(212, 165, 116, 0.04);
}

.ot-tbl tfoot td {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  border-bottom: none;
  font-weight: 600;
  padding: 9px 14px;
}

/* Row states */
.ot-tbl tr.row-off {
  opacity: 0.42;
  transition: opacity 0.2s ease;
}

.ot-tbl tr.row-on {
  opacity: 1;
}

.ot-tbl tr.row-on td {
  background: rgba(212, 165, 116, 0.035);
}

.ot-tbl tr.is-fri td {
  color: var(--gold);
}

.ot-tbl tr.is-sat td {
  color: #86efac;
}

/* OT table selects */
.ot-tbl select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-family: inherit;
  width: 100%;
  transition: var(--t-fast);
  appearance: none;
  -webkit-appearance: none;
}

.ot-tbl select:not(:disabled):hover {
  border-color: var(--border-light);
}

.ot-tbl select:not(:disabled):focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.08);
}

.ot-tbl select:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.ot-tbl input[type=checkbox],
.ot-cb {
  width: 15px;
  height: 15px;
  accent-color: var(--gold);
  cursor: pointer;
}

.hc {
  text-align: right;
  font-weight: 700;
  color: var(--gold);
  min-width: 58px;
}

.dc {
  white-space: nowrap;
}

/* ===================== ACCORDION ===================== */

/* Override outer container — now holds accordion, not grid items */
#empGrid {
  display: block;
}

/* Dept group */
.acc-dept {
  border-bottom: 1px solid var(--border);
}

.acc-dept:last-child {
  border-bottom: none;
}

.acc-dept-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  cursor: pointer;
  background: linear-gradient(90deg, rgba(212, 165, 116, 0.06) 0%, transparent 60%);
  border-left: 3px solid var(--gold-dim);
  transition: var(--t-fast);
  user-select: none;
}

.acc-dept-hd:hover {
  background: linear-gradient(90deg, rgba(212, 165, 116, 0.1) 0%, transparent 60%);
}

.acc-dept-name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--gold2);
  flex: 1;
}

.acc-dept-bd {
  border-top: 1px solid var(--border);
  overflow: hidden;
}

/* Branch group */
.acc-branch {
  border-bottom: 1px solid rgba(212, 165, 116, 0.04);
}

.acc-branch:last-child {
  border-bottom: none;
}

.acc-branch-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px 10px 38px;
  cursor: pointer;
  background: rgba(17, 24, 40, 0.4);
  border-left: 3px solid transparent;
  border-left-color: rgba(74, 144, 226, 0.3);
  transition: var(--t-fast);
  user-select: none;
}

.acc-branch-hd:hover {
  background: rgba(74, 144, 226, 0.06);
}

.acc-branch-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  flex: 1;
}

.acc-branch-bd {
  overflow: hidden;
}

/* Arrow indicators */
.acc-arrow {
  font-size: 11px;
  color: var(--gold-dim);
  transition: transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  display: inline-block;
  width: 14px;
  text-align: center;
}

.acc-arrow-sm {
  font-size: 10px;
  color: var(--muted);
}

/* Count badge */
.acc-count {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 9px;
  margin-left: 4px;
  flex-shrink: 0;
}

/* Inner card grid (inside branch body) */
.acc-emp-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  padding: 14px 22px 18px 38px;
}

/* Table accordion rows */
.acc-tbl-dept {
  cursor: pointer;
  user-select: none;
}

.acc-tbl-dept td {
  background: linear-gradient(90deg, rgba(212, 165, 116, 0.07) 0%, transparent 70%) !important;
  border-left: 3px solid var(--gold-dim);
  padding: 11px 16px !important;
  font-size: var(--text-sm);
}

.acc-tbl-dept:hover td {
  background: linear-gradient(90deg, rgba(212, 165, 116, 0.12) 0%, transparent 70%) !important;
}

.acc-tbl-branch {
  cursor: pointer;
  user-select: none;
}

.acc-tbl-branch td {
  background: rgba(17, 24, 40, 0.5) !important;
  border-left: 3px solid rgba(74, 144, 226, 0.3);
  padding: 9px 16px 9px 36px !important;
  font-size: var(--text-sm);
}

.acc-tbl-branch:hover td {
  background: rgba(74, 144, 226, 0.05) !important;
}

.acc-tbl-emp td {
  padding-left: 52px !important;
}

/* ===================== EMPLOYEE GRID ===================== */
.emp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  padding: 18px 22px;
}

.emp-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: var(--t);
  position: relative;
  cursor: pointer;
}

.emp-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.emp-card.selected {
  border-color: var(--gold);
  background: linear-gradient(145deg, rgba(212, 165, 116, 0.12), rgba(212, 165, 116, 0.04));
  box-shadow: 0 0 0 1px var(--gold), var(--glow-gold);
}

.emp-card.selected::before {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  background: var(--gold);
  border-radius: 50%;
  color: #111;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 22px;
  text-align: center;
  z-index: 3;
}

.emp-acts {
  display: flex;
  gap: 4px;
  position: absolute;
  top: 8px;
  right: 8px;
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 4;
}

.emp-card:not(.selected):hover .emp-acts {
  opacity: 1;
}

.emp-card-body {
  padding: 14px 14px 12px;
}

.emp-name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--white);
  margin-bottom: 6px;
  line-height: 1.45;
  padding-right: 12px;
}

.emp-meta {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.8;
}

/* ===================== STEP INDICATOR ===================== */
.steps {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 20px;
}

.step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--bg-card);
  flex: 1;
  transition: var(--t);
  position: relative;
  overflow: hidden;
}

.step::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background 0.3s ease;
}

.step.active {
  border-color: rgba(212, 165, 116, 0.28);
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.1), rgba(212, 165, 116, 0.04));
}

.step.active::before {
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.step.done {
  border-color: rgba(34, 197, 94, 0.25);
  background: rgba(34, 197, 94, 0.05);
}

.step.done::before {
  background: linear-gradient(90deg, transparent, var(--success), transparent);
}

.step-arrow {
  color: var(--muted);
  font-size: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
  transition: var(--t);
}

.step.active .step-num {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  border-color: var(--gold);
  color: #111;
  box-shadow: 0 0 14px rgba(212, 165, 116, 0.35);
}

.step.done .step-num {
  background: linear-gradient(135deg, #166534, var(--success));
  border-color: var(--success);
  color: #000;
}

.step-info {
  flex: 1;
  min-width: 0;
}

.step-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  transition: color 0.25s ease;
}

.step.active .step-title {
  color: var(--gold2);
}

.step.done .step-title {
  color: #4ade80;
}

.step-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ===================== BILL CONTROLS ===================== */
.bill-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 24, 40, 0.5);
}

/* ===================== FORM ELEMENTS ===================== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.form-group.full {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.form-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 13px;
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-sm);
  transition: var(--t-fast);
  width: 100%;
}

.form-input:hover {
  border-color: var(--border-light);
}

.form-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-hover);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.09);
}

.form-input::placeholder {
  color: var(--muted);
}

select.form-input {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235a6e80'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}

select.form-input option {
  background: var(--bg-elevated);
  color: var(--text);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--muted);
  margin-top: 1px;
}

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  transition: var(--t);
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97) !important;
}

/* Ripple layer */
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background 0.15s ease;
  border-radius: inherit;
}

.btn:hover::after {
  background: rgba(255, 255, 255, 0.06);
}

.btn:active::after {
  background: rgba(0, 0, 0, 0.1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold-dim) 40%, var(--gold) 100%);
  color: #0d0a06;
  border-color: var(--gold);
  box-shadow: 0 2px 10px rgba(212, 165, 116, 0.22);
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(212, 165, 116, 0.38);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-light);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--gold-dim);
  color: var(--gold2);
  background: var(--gold-glow);
}

.btn-danger {
  background: #dc2626;
  border-color: #b91c1c;
  color: #ffffff;
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #7f1d1d;
  color: #ffffff;
}

.btn-success {
  background: linear-gradient(135deg, #14532d, #15803d, var(--success));
  color: #000;
  border-color: var(--success);
  box-shadow: 0 2px 10px rgba(34, 197, 94, 0.2);
}

.btn-success:hover {
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.38);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

.btn-xs {
  padding: 4px 9px;
  font-size: 11px;
  border-radius: var(--r-sm);
}

.w-full {
  width: 100%;
}

/* ===================== BADGES ===================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.badge-blue {
  background: #2563eb;
  color: #eff6ff;
  border: 1px solid rgba(96, 165, 250, 0.45);
}

.badge-gold {
  background: #b45309;
  color: #ffffff;
  border: 1px solid rgba(245, 158, 11, 0.45);
}

.badge-green {
  background: #15803d;
  color: #ffffff;
  border: 1px solid rgba(34, 197, 94, 0.45);
}

/* ===================== SUMMARY BOX ===================== */
.summary-panel {
  padding: 20px 22px;
}

.summary-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  height: 100%;
}

.sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid rgba(212, 165, 116, 0.06);
  font-size: var(--text-sm);
}

.sum-row:last-of-type {
  border-bottom: none;
}

.sum-total {
  margin: 6px -4px;
  padding: 11px 4px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, rgba(212, 165, 116, 0.08), rgba(212, 165, 116, 0.04));
  border: 1px solid rgba(212, 165, 116, 0.12);
}

.sv {
  font-weight: 700;
  color: var(--gold2);
  font-size: var(--text-base);
}

.sum-total .sv {
  font-size: var(--text-xl);
  color: var(--gold);
  text-shadow: 0 0 20px rgba(212, 165, 116, 0.4);
}

.sum-words {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(212, 165, 116, 0.05);
  border-left: 3px solid var(--gold-dim);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ===================== SEARCH ===================== */
.search {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===================== OVERLAYS & MODALS ===================== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.overlay.open {
  display: flex;
  animation: overlayFade 0.22s ease;
}

@keyframes overlayFade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-xl);
  padding: 26px;
  width: 520px;
  max-width: 96vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  animation: modalPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

.modal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  opacity: 0.5;
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(12px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 12px;
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--white);
}

.modal-x {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--t-fast);
  flex-shrink: 0;
  cursor: pointer;
}

.modal-x:hover {
  background: var(--bg-hover);
  color: var(--white);
  border-color: var(--border-light);
}

/* ===================== ADMIN MODAL ===================== */
.admin-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 20px;
}

.admin-tab {
  flex: 1;
  padding: 9px 12px;
  background: transparent;
  color: var(--muted);
  border: none;
  font-family: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  font-weight: 500;
  transition: var(--t-fast);
}

.admin-tab.active,
.admin-tab:is(#adminTabLogin.active, #adminTabChange.active) {
  background: rgba(212, 165, 116, 0.12);
  color: var(--gold2);
  font-weight: 700;
}

.admin-tab:hover:not(.active) {
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

/* ===================== TOASTS ===================== */
.toasts {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: var(--r);
  font-size: var(--text-sm);
  font-weight: 500;
  min-width: 230px;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: toastIn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), toastOut 0.3s ease 3.1s forwards;
}

.toast.ok {
  background: #d1fae5;
  border: 1px solid #22c55e;
  color: #064e3b;
}

.toast.er {
  background: #fee2e2;
  border: 1px solid #f87171;
  color: #7f1d1d;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(110%) scale(0.88);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(60%);
  }
}

/* ===================== EMPTY STATES ===================== */
.empty {
  text-align: center;
  padding: 52px 20px;
  color: var(--muted);
}

.empty-ico {
  font-size: 44px;
  opacity: 0.35;
  margin-bottom: 14px;
  display: block;
  filter: grayscale(0.3);
}

.empty h3 {
  color: var(--text-secondary);
  font-size: var(--text-base);
  margin-bottom: 6px;
  font-weight: 600;
}

.empty p {
  font-size: var(--text-sm);
  margin-bottom: 18px;
}

/* ===================== PRINT AREA ===================== */
.print-area {
  display: none;
}

.print-preview {
  overflow: auto;
  max-height: 68vh;
  background: #e8e4dc;
  border-radius: var(--r);
  padding: 16px;
  display: flex;
  justify-content: center;
}

/* ===================== A4 PRINT STYLES ===================== */
.a4 {
  width: 210mm;
  min-width: 210mm;
  height: 297mm;
  padding: 12mm 14mm 10mm 14mm;
  background: #fff;
  color: #000;
  font-family: "Nikosh", "Times New Roman", serif;
  font-size: 15.8px;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.a4-head-org {
  text-align: center;
  font-size: 24.9px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #000;
  line-height: 1.3;
}

.a4-head-addr {
  text-align: center;
  font-size: 19.8px;
  margin-bottom: 5px;
  color: #000;
}

.a4-head-form {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
  text-decoration: underline;
  color: #000;
}

.a4-emp-tbl {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
  font-size: 14.7px;
}

.a4-emp-tbl td {
  padding: 2px 6px;
  color: #000;
}

.a4-emp-tbl td.al {
  white-space: nowrap;
  font-weight: 600;
}

.a4-ot-tbl {
  width: 100%;
  border-collapse: collapse;
  border: 1.5px solid #000;
  font-size: 14.7px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.a4-ot-tbl th,
.a4-ot-tbl td {
  border: 1px solid #000;
  padding: 4px 6px;
  text-align: center;
  vertical-align: middle;
  color: #000;
}

.a4-ot-tbl th {
  font-weight: 700;
  background: #f5f5f5;
}

.a4-ot-tbl .dc-cell {
  text-align: justify;
  vertical-align: top;
  font-size: 13.6px;
  line-height: 1.6;
}

.a4-ot-tbl .total-row td {
  font-weight: 700;
  background: #f0f0f0;
}

.a4-summary {
  font-size: 14.7px;
  line-height: 1.9;
  margin-bottom: 8px;
  color: #000;
}

.a4-verify {
  font-size: 14.7px;
  margin-bottom: 8px;
  color: #000;
}

.a4-ti-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.7px;
  margin-bottom: 5px;
}

.a4-ti-tbl td {
  padding: 1px 4px;
  color: #000;
}

.a4-approval {
  font-size: 14.7px;
  line-height: 2;
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #000;
}

.a4-sigs {
  display: flex;
  justify-content: space-between;
  font-size: 14.7px;
  margin-top: auto;
  color: #000;
}

.a4-sig-col {
  text-align: center;
  padding-top: 36px;
  width: 30%;
  color: #000;
}

/* Print media */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  body>* {
    display: none !important;
  }

  body>#printArea {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    left: auto !important;
  }

  #printArea .a4 {
    width: 210mm !important;
    height: 297mm !important;
    background: white !important;
    overflow: hidden !important;
    font-family: 'Nikosh', 'Times New Roman', serif !important;
    display: flex !important;
    flex-direction: column !important;
    box-sizing: border-box !important;
  }
}

/* ===================== UTILITIES ===================== */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.items-end {
  align-items: flex-end;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 {
  gap: 4px;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

.mb-3 {
  margin-bottom: 12px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-3 {
  margin-top: 12px;
}

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

.text-sm {
  font-size: var(--text-sm);
}

.text-xs {
  font-size: var(--text-xs);
}

.text-gold {
  color: var(--gold);
}

.bold {
  font-weight: 700;
}