:root {
  --bg: #0f0f0d;
  --bg-2: #11110f;
  --card: #1a1a17;
  --card-2: #20201c;
  --gold: #c8a45d;
  --beige: #e8d8b8;
  --text: #f4f1ea;
  --muted: #a9a295;
  --line: rgba(232, 216, 184, .12);
  --danger: #c85c5c;
  --success: #7bae7f;
  --shadow: 0 22px 70px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(115deg, transparent 0 44%, rgba(200, 164, 93, .10) 45%, transparent 47% 100%),
    linear-gradient(145deg, transparent 0 58%, rgba(232, 216, 184, .05) 59%, transparent 61% 100%),
    linear-gradient(rgba(232, 216, 184, .028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 216, 184, .028) 1px, transparent 1px),
    radial-gradient(circle at top right, rgba(200, 164, 93, .13), transparent 32rem),
    var(--bg);
  background-size: auto, auto, 72px 72px, 72px 72px, auto, auto;
  background-position: center, center, 0 0, 0 0, center, center;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  animation: appBackgroundShift 36s ease-in-out infinite alternate;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 292px;
  flex: 0 0 292px;
  background: rgba(14, 14, 12, .96);
  border-right: 1px solid var(--line);
  padding: 26px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.brand { display: grid; gap: 8px; margin-bottom: 30px; }
.brand-logo {
  display: block;
  width: min(220px, 100%);
  height: auto;
  object-fit: contain;
}
.brand small { display: block; color: var(--muted); letter-spacing: .18em; text-transform: uppercase; font-size: 10px; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a {
  color: var(--muted);
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
}
.sidebar nav a:hover, .sidebar nav a.active {
  color: var(--text);
  background: rgba(200, 164, 93, .10);
  border-color: rgba(200, 164, 93, .20);
}
.sidebar nav a.active { box-shadow: inset 3px 0 0 var(--gold); }
.sidebar-services {
  margin-top: auto;
  padding-top: 22px;
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
}
.sidebar-services span {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.sidebar-services img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: invert(76%) sepia(34%) saturate(508%) hue-rotate(3deg) brightness(91%) contrast(86%);
  opacity: .9;
}

.main-shell { flex: 1; min-width: 0; }
.topbar {
  min-height: 92px;
  padding: 22px 32px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(15, 15, 13, .72);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar h1 { margin: 2px 0 0; font-size: 26px; font-weight: 650; }
.topbar-user { display: flex; align-items: center; gap: 12px; color: var(--beige); }
.menu-toggle { display: none; }
.eyebrow { color: var(--gold); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.content { padding: 32px; display: grid; gap: 24px; }
.content.narrow { max-width: 920px; }

.panel, .stat-card, .hero-panel, .login-card {
  background:
    linear-gradient(145deg, rgba(255,255,255,.045), transparent 34%),
    linear-gradient(180deg, rgba(200, 164, 93, .07), transparent 36%),
    rgba(26, 26, 23, .90);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 26px 80px rgba(0, 0, 0, .40), inset 0 1px 0 rgba(255,255,255,.04);
  backdrop-filter: blur(12px);
}
.panel { padding: 22px; overflow: hidden; }
.panel h2 { margin: 0 0 18px; font-size: 20px; font-weight: 650; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.panel-head h2 { margin: 0; }
.hero-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 34px;
}
.hero-panel h2 { margin: 6px 0 8px; font-size: 31px; }
.hero-panel p { margin: 0; color: var(--muted); }
.welcome-panel { align-items: flex-start; }
.welcome-panel h2 { margin: 8px 0 10px; font-size: clamp(24px, 4vw, 34px); }
.session-meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.session-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(232, 216, 184, .17);
  color: var(--beige);
  background: rgba(200, 164, 93, .08);
  font-size: 13px;
}

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stats-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-card { padding: 22px; transition: transform .18s ease, border-color .18s ease; }
.stat-card:hover { transform: translateY(-2px); border-color: rgba(200, 164, 93, .28); }
.stat-card span { color: var(--muted); }
.stat-card strong { display: block; margin-top: 10px; font-size: 34px; color: var(--beige); }
.stat-card small { color: var(--muted); }
.stat-card.danger strong { color: #e39a9a; }
.grid-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid-form-table { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 24px; align-items: start; }

.bar-row { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr 42px; align-items: center; gap: 12px; padding: 9px 0; color: var(--muted); }
.bar-row div { height: 8px; border-radius: 999px; background: rgba(232, 216, 184, .10); overflow: hidden; }
.bar-row i { display: block; height: 100%; min-width: 5%; background: linear-gradient(90deg, var(--gold), var(--beige)); }
.list-row { padding: 13px 0; border-bottom: 1px solid var(--line); }
.list-row strong { display: block; }
.list-row span { display: block; color: var(--muted); margin-top: 4px; }

.form-stack, .form-grid { display: grid; gap: 14px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
label { color: var(--beige); display: grid; gap: 7px; }
input, select, textarea {
  width: 100%;
  color: var(--text);
  background: #121210;
  border: 1px solid rgba(232, 216, 184, .18);
  border-radius: 8px;
  padding: 12px 13px;
  outline: none;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(200, 164, 93, .70); box-shadow: 0 0 0 3px rgba(200, 164, 93, .12); }
.form-actions { display: flex; justify-content: flex-end; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.filters > * { width: auto; min-width: 150px; }
.withdrawal-lines { display: grid; gap: 12px; }
.withdrawal-line {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(120px, .6fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .025);
  position: relative;
  overflow: hidden;
}
.withdrawal-line::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--line-accent, var(--gold));
}
.withdrawal-line:nth-child(4n + 1) {
  --line-accent: #c8a45d;
  background: linear-gradient(90deg, rgba(200, 164, 93, .14), rgba(255, 255, 255, .025) 38%);
  border-color: rgba(200, 164, 93, .22);
}
.withdrawal-line:nth-child(4n + 2) {
  --line-accent: #7bae7f;
  background: linear-gradient(90deg, rgba(123, 174, 127, .13), rgba(255, 255, 255, .025) 38%);
  border-color: rgba(123, 174, 127, .22);
}
.withdrawal-line:nth-child(4n + 3) {
  --line-accent: #7c9fbc;
  background: linear-gradient(90deg, rgba(124, 159, 188, .14), rgba(255, 255, 255, .025) 38%);
  border-color: rgba(124, 159, 188, .24);
}
.withdrawal-line:nth-child(4n) {
  --line-accent: #c85c5c;
  background: linear-gradient(90deg, rgba(200, 92, 92, .12), rgba(255, 255, 255, .025) 38%);
  border-color: rgba(200, 92, 92, .22);
}
.withdrawal-line .btn { min-height: 45px; }
.withdrawal-line .btn:disabled {
  cursor: not-allowed;
  opacity: .35;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 15px;
  border-radius: 8px;
  border: 1px solid rgba(200, 164, 93, .35);
  cursor: pointer;
  color: var(--beige);
  background: transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--gold); color: #17140d; border-color: var(--gold); font-weight: 700; }
.btn-secondary { color: var(--beige); background: rgba(200, 164, 93, .06); }
.btn.danger { color: #ffd6d6; border-color: rgba(200, 92, 92, .45); background: rgba(200, 92, 92, .12); }
.btn.tiny { min-height: 32px; padding: 6px 9px; font-size: 12px; }
.btn.full { width: 100%; }
.btn-large { min-height: 54px; padding: 14px 22px; font-size: 16px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--beige); background: rgba(255, 255, 255, .025); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
td { color: var(--muted); }
td small { display: block; margin-top: 4px; color: var(--muted); opacity: .78; }
tbody tr:hover { background: rgba(200, 164, 93, .045); }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(200, 164, 93, .13);
  color: var(--beige);
  border: 1px solid rgba(200, 164, 93, .22);
  font-size: 12px;
}
.badge.danger { color: #ffd6d6; background: rgba(200, 92, 92, .13); border-color: rgba(200, 92, 92, .30); }
.badge.success { color: #d8f1d9; background: rgba(123, 174, 127, .13); border-color: rgba(123, 174, 127, .30); }

.alert, .toast {
  border-radius: 8px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  background: var(--card-2);
}
.alert.error, .toast.error { color: #ffd6d6; border-color: rgba(200, 92, 92, .32); background: rgba(200, 92, 92, .12); }
.alert.warning { color: var(--beige); border-color: rgba(200, 164, 93, .35); background: rgba(200, 164, 93, .10); display: flex; gap: 10px; flex-wrap: wrap; }
.toast.success { color: #d8f1d9; border-color: rgba(123, 174, 127, .35); background: rgba(123, 174, 127, .12); }
.toast {
  position: fixed;
  right: 22px;
  top: 105px;
  z-index: 20;
  box-shadow: var(--shadow);
  transition: .25s ease;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(115deg, transparent 0 44%, rgba(200, 164, 93, .12) 45%, transparent 47% 100%),
    linear-gradient(145deg, transparent 0 58%, rgba(232, 216, 184, .07) 59%, transparent 61% 100%),
    linear-gradient(rgba(232, 216, 184, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 216, 184, .035) 1px, transparent 1px),
    radial-gradient(circle at 50% 0%, rgba(200, 164, 93, .20), transparent 31rem),
    radial-gradient(circle at 82% 72%, rgba(232, 216, 184, .08), transparent 23rem),
    var(--bg);
  background-size: auto, auto, 76px 76px, 76px 76px, auto, auto, auto;
  background-position: center, center, 0 0, 0 0, center, center, center;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  animation: loginBackgroundShift 24s ease-in-out infinite alternate;
}
.login-page .brand-logo {
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, .34));
}
.login-card {
  width: min(452px, 100%);
  padding: 38px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.055), transparent 34%),
    linear-gradient(180deg, rgba(200, 164, 93, .08), transparent 36%),
    rgba(26, 26, 23, .90);
  border-color: rgba(232, 216, 184, .18);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .48), inset 0 1px 0 rgba(255,255,255,.045);
  backdrop-filter: blur(22px);
  position: relative;
  z-index: 2;
  overflow: hidden;
  animation: loginCardEnter .55s ease both;
}
.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--beige), transparent);
  opacity: .76;
}
.login-card::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  right: -72px;
  top: -72px;
  border: 1px solid rgba(200, 164, 93, .16);
  transform: rotate(45deg);
}
.login-card > * {
  position: relative;
  z-index: 1;
}
.login-card input {
  background: rgba(11, 11, 10, .78);
}
.login-card .btn-primary {
  box-shadow: 0 14px 34px rgba(200, 164, 93, .20);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.login-card .btn-primary:hover {
  background: #d8b66c;
  box-shadow: 0 18px 42px rgba(200, 164, 93, .28);
  transform: translateY(-1px);
}
@keyframes appBackgroundShift {
  from { background-position: 50% 50%, 50% 50%, 0 0, 0 0, 100% 0, center; }
  to { background-position: 54% 47%, 46% 53%, 72px 72px, -72px 72px, 96% 4%, center; }
}
@keyframes loginBackgroundShift {
  from { background-position: 50% 50%, 50% 50%, 0 0, 0 0, 50% 0%, 82% 72%, center; }
  to { background-position: 54% 47%, 46% 53%, 76px 76px, -76px 76px, 48% 3%, 78% 68%, center; }
}
@keyframes loginCardEnter {
  from { opacity: 0; transform: translateY(12px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-brand { margin-bottom: 24px; justify-items: start; }
.login-logo { width: min(300px, 100%); }
.login-card h1 { margin: 0 0 8px; font-size: 34px; }
.login-card p { margin: 0 0 22px; color: var(--muted); }
.mobile-withdrawal-list { display: none; }
.role-employee .mobile-withdrawal-list { display: grid; gap: 10px; }
.employee-quote {
  --quote-size: clamp(23px, 2.8vw, 33px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 86px;
  padding: 4px 18px;
  text-align: center;
  position: relative;
}
.employee-quote blockquote {
  margin: 0;
  max-width: 680px;
  color: var(--beige);
  font-size: var(--quote-size);
  line-height: 1.25;
  font-weight: 300;
}
.employee-quote .quote-kicker {
  color: #c8a45d;
  font-size: calc(var(--quote-size) * .4335);
  font-style: normal;
  font-weight: 400;
  letter-spacing: .132em;
}
.employee-quote cite {
  display: block;
  color: var(--muted);
  font-size: calc(var(--quote-size) * .6);
  font-style: italic;
}
.empty-state { margin: 0; color: var(--muted); }
.withdrawal-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .025);
}
.withdrawal-card strong,
.withdrawal-card span,
.withdrawal-card small,
.withdrawal-card b { display: block; }
.withdrawal-card strong { color: var(--text); }
.withdrawal-card span,
.withdrawal-card small { color: var(--muted); }
.withdrawal-card b { color: var(--gold); font-size: 18px; }

@media (max-width: 1060px) {
  .stats-grid, .grid-two, .grid-form-table { grid-template-columns: 1fr; }
  .stats-grid.compact { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .login-page { padding: 18px; }
  .login-page {
    background-size: auto, auto, 58px 58px, 58px 58px, auto, auto, auto;
  }
  .login-card {
    padding: 28px;
    background:
      linear-gradient(145deg, rgba(255,255,255,.045), transparent 34%),
      linear-gradient(180deg, rgba(200, 164, 93, .07), transparent 36%),
      rgba(26, 26, 23, .96);
  }
  .login-card::after { width: 118px; height: 118px; right: -64px; top: -64px; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .menu-toggle { display: inline-flex; min-width: 40px; min-height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--beige); align-items: center; justify-content: center; }
  .topbar { padding: 16px; align-items: flex-start; }
  .topbar h1 { font-size: 21px; }
  .topbar-user { flex-direction: column; align-items: flex-end; gap: 8px; }
  .content { padding: 18px; }
  .session-meta { gap: 8px; }
  .session-meta span { font-size: 12px; }
  .hero-panel, .panel-head { flex-direction: column; align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .filters > * { width: 100%; }
  .withdrawal-line { grid-template-columns: 1fr; padding: 12px; }
  .withdrawal-form .form-actions .btn,
  .withdrawal-form [data-add-line] { width: 100%; min-height: 52px; }
  .role-employee .content { padding: 14px; gap: 14px; }
  .role-employee .topbar { min-height: 66px; align-items: center; }
  .role-employee .topbar .eyebrow,
  .role-employee .topbar-user span { display: none; }
  .role-employee .topbar-user .btn { min-height: 36px; padding: 8px 11px; }
  .role-employee .employee-action-panel {
    padding: 20px;
    gap: 18px;
  }
  .role-employee .employee-action-panel h2 {
    font-size: 30px;
    margin: 4px 0 6px;
  }
  .role-employee .employee-action-panel p { font-size: 15px; }
  .role-employee .employee-action-panel .btn {
    width: 100%;
    min-height: 58px;
    font-size: 17px;
  }
  .role-employee .employee-stats { display: block; }
  .employee-quote { --quote-size: 22px; min-height: 74px; padding: 2px 14px; }
  .role-employee .employee-stats .stat-card {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 16px;
  }
  .role-employee .employee-stats .stat-card strong {
    margin: 0;
    font-size: 32px;
  }
  .role-employee .employee-latest-panel { padding: 18px; box-shadow: none; }
  .role-employee .employee-latest-panel h2 { font-size: 18px; margin-bottom: 12px; }
  .role-employee .desktop-only { display: none; }
  .role-employee .mobile-withdrawal-list { display: grid; gap: 10px; }
  .role-employee .sidebar-services { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .login-page,
  .login-card {
    animation: none;
  }
}

@media print {
  body { background: #fff; color: #111; }
  .sidebar, .topbar, .no-print, .btn, .toast { display: none !important; }
  .content { padding: 0; }
  .panel { box-shadow: none; border: 0; background: #fff; color: #111; }
  table, th, td { color: #111; border-color: #ddd; }
}
