:root {
  --background: #07111f;
  --background-deep: #040a12;
  --surface: #0d1a2b;
  --surface-soft: #112238;
  --surface-raised: #152943;
  --surface-hover: #19304d;
  --border: #263851;
  --border-soft: rgba(148, 163, 184, 0.16);
  --gold: #d4af37;
  --gold-light: #f1d27a;
  --gold-dark: #8f6a13;
  --text-primary: #f8fafc;
  --text-secondary: #9fb0c7;
  --text-muted: #71829a;
  --success: #10b981;
  --success-soft: rgba(16, 185, 129, 0.13);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.13);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.13);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.13);
  --sidebar-width: 278px;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
  --transition: 180ms ease;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--background);
  color: var(--text-primary);
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
svg { width: 20px; height: 20px; }
svg path, svg circle, svg rect, svg polyline, svg line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
button { color: inherit; }
::selection { color: #06101d; background: var(--gold-light); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--background-deep); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 20px; border: 2px solid var(--background-deep); }
::-webkit-scrollbar-thumb:hover { background: #3a4f6b; }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.25; }
h2 { font-size: clamp(1.45rem, 2.5vw, 2rem); margin-bottom: 8px; letter-spacing: -0.025em; }
h3 { font-size: 1.05rem; margin-bottom: 6px; }
p { color: var(--text-secondary); margin-bottom: 0; }
small { color: var(--text-muted); }
.mono { direction: ltr; unicode-bidi: isolate; font-family: Consolas, "Courier New", monospace; letter-spacing: 0.02em; }
.eyebrow { margin: 0 0 5px; color: var(--text-muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.eyebrow.gold, .gold { color: var(--gold-light); }
.text-success { color: var(--success) !important; }
.text-danger { color: #fb7185 !important; }
.text-warning { color: var(--warning) !important; }
.full-width { grid-column: 1 / -1; }
.span-two { grid-column: span 2; }
.grow { flex: 1 1 260px; }
.inline-form { display: inline-flex; }

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
  transition: transform var(--transition), background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button svg { width: 18px; height: 18px; }
.button-primary {
  color: #09111d;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 9px 24px rgba(212, 175, 55, 0.18);
}
.button-primary:hover { box-shadow: 0 11px 30px rgba(212, 175, 55, 0.28); }
.button-secondary { color: var(--gold-light); background: rgba(212, 175, 55, 0.09); border-color: rgba(212, 175, 55, 0.38); }
.button-secondary:hover { background: rgba(212, 175, 55, 0.15); border-color: var(--gold); }
.button-ghost { color: var(--text-secondary); background: transparent; border-color: var(--border); }
.button-ghost:hover { color: var(--text-primary); background: var(--surface-hover); }
.button-danger-outline { color: #fda4af; background: transparent; border-color: rgba(239, 68, 68, 0.42); }
.button-danger-outline:hover { background: var(--danger-soft); border-color: var(--danger); }
.button-block { width: 100%; }
.button-large { min-height: 50px; font-size: 1rem; }
.button-small { min-height: 36px; padding: 7px 12px; font-size: 0.82rem; }
.text-link { color: var(--gold-light); font-weight: 800; transition: color var(--transition); }
.text-link:hover { color: #fff2b9; }
.text-button { align-self: flex-start; padding: 0; border: 0; background: transparent; color: var(--gold-light); cursor: pointer; font-weight: 800; }
.back-link { display: inline-flex; margin-bottom: 11px; color: var(--text-secondary); font-weight: 700; }
.back-link:hover { color: var(--gold-light); }
.icon-button {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.icon-button:hover { color: var(--gold-light); border-color: rgba(212, 175, 55, 0.45); background: rgba(212, 175, 55, 0.08); }
.icon-button.small { width: 34px; height: 34px; border-radius: 9px; }
.icon-button.small svg { width: 17px; height: 17px; }
.icon-button.danger:hover { color: #fda4af; border-color: rgba(239, 68, 68, 0.45); background: var(--danger-soft); }

.public-body {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(212, 175, 55, 0.12), transparent 28%),
    radial-gradient(circle at 85% 85%, rgba(14, 116, 144, 0.16), transparent 32%),
    var(--background-deep);
}
.public-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 0.9fr) minmax(480px, 1.1fr); }
.public-brand-panel { position: relative; min-height: 100%; display: grid; place-items: center; padding: 48px; overflow: hidden; border-left: 1px solid rgba(212, 175, 55, 0.18); }
.public-brand-panel::before, .public-brand-panel::after { content: ""; position: absolute; border: 1px solid rgba(212, 175, 55, 0.12); border-radius: 50%; }
.public-brand-panel::before { width: 520px; height: 520px; top: -190px; right: -180px; }
.public-brand-panel::after { width: 360px; height: 360px; bottom: -160px; left: -120px; }
.public-brand-inner { position: relative; z-index: 1; max-width: 440px; text-align: center; }
.public-logo { width: 165px; height: 165px; margin: 0 auto 28px; filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.3)); }
.public-brand-inner h1 { margin: 0 0 8px; font-size: clamp(2.6rem, 6vw, 4.8rem); color: var(--gold-light); letter-spacing: -0.04em; }
.public-brand-inner > p:not(.eyebrow) { font-size: 1.2rem; }
.brand-features { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.brand-features span { padding: 7px 11px; border: 1px solid rgba(212, 175, 55, 0.22); border-radius: 999px; color: var(--text-secondary); background: rgba(13, 26, 43, 0.55); font-size: 0.8rem; }
.public-form-panel { display: grid; place-items: center; padding: 46px; }
.auth-card { width: min(100%, 680px); padding: clamp(28px, 5vw, 52px); border: 1px solid var(--border-soft); border-radius: 28px; background: rgba(13, 26, 43, 0.86); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.auth-heading { margin-bottom: 28px; }
.auth-heading h2 { font-size: 2rem; }
.auth-heading p { max-width: 520px; }
.auth-note { margin-top: 20px; text-align: center; font-size: 0.8rem; }

.sidebar {
  position: fixed;
  z-index: 60;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(13, 26, 43, 0.98), rgba(5, 12, 22, 0.99));
  box-shadow: -18px 0 42px rgba(0, 0, 0, 0.18);
}
.sidebar-brand { min-height: 94px; display: flex; align-items: center; padding: 18px 17px; border-bottom: 1px solid var(--border-soft); }
.brand-link { min-width: 0; display: flex; align-items: center; gap: 12px; flex: 1; }
.brand-logo { width: 54px; height: 54px; flex: 0 0 auto; }
.brand-copy { min-width: 0; display: flex; flex-direction: column; }
.brand-copy strong { overflow: hidden; color: var(--gold-light); font-size: 1.25rem; text-overflow: ellipsis; white-space: nowrap; }
.brand-copy small { margin-top: -2px; font-size: 0.75rem; }
.sidebar-close { display: none; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 18px 12px; }
.nav-link { position: relative; display: flex; align-items: center; gap: 13px; min-height: 45px; margin-bottom: 4px; padding: 10px 13px; border: 1px solid transparent; border-radius: 12px; color: var(--text-secondary); font-weight: 700; transition: color var(--transition), background var(--transition), border-color var(--transition); }
.nav-link svg { width: 19px; height: 19px; flex: 0 0 auto; }
.nav-link:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.035); }
.nav-link.active { color: var(--gold-light); border-color: rgba(212, 175, 55, 0.2); background: linear-gradient(90deg, rgba(212, 175, 55, 0.13), rgba(212, 175, 55, 0.035)); }
.nav-link.active::after { content: ""; position: absolute; top: 10px; right: -13px; bottom: 10px; width: 3px; border-radius: 4px; background: var(--gold); box-shadow: 0 0 16px rgba(212, 175, 55, 0.6); }
.sidebar-footer { min-height: 80px; display: flex; align-items: center; gap: 10px; padding: 14px; border-top: 1px solid var(--border-soft); }
.user-mini { min-width: 0; display: flex; align-items: center; gap: 10px; flex: 1; }
.avatar { width: 38px; height: 38px; display: inline-grid; place-items: center; flex: 0 0 auto; border: 1px solid rgba(212, 175, 55, 0.45); border-radius: 50%; color: #09111d; background: linear-gradient(135deg, var(--gold-light), var(--gold-dark)); font-weight: 900; }
.user-mini-copy { min-width: 0; display: flex; flex-direction: column; }
.user-mini-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-mini-copy small { font-size: 0.72rem; }
.logout-form { display: flex; }
.sidebar-overlay { display: none; }

.app-frame { min-height: 100vh; display: flex; flex-direction: column; margin-right: var(--sidebar-width); }
.topbar { position: sticky; z-index: 45; top: 0; min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 17px clamp(20px, 3vw, 42px); border-bottom: 1px solid var(--border-soft); background: rgba(7, 17, 31, 0.87); backdrop-filter: blur(18px); }
.topbar-leading { min-width: 0; display: flex; align-items: center; gap: 13px; }
.topbar-leading h1 { margin: 0; font-size: 1.45rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-leading .eyebrow { margin-bottom: 2px; }
.menu-button { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.date-pill, .profile-chip { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 7px 12px; border: 1px solid var(--border-soft); border-radius: 13px; color: var(--text-secondary); background: rgba(13, 26, 43, 0.68); }
.date-pill svg { width: 17px; height: 17px; color: var(--gold); }
.profile-chip { padding-left: 14px; transition: border-color var(--transition), background var(--transition); }
.profile-chip:hover { border-color: rgba(212, 175, 55, 0.4); background: var(--surface-soft); }
.profile-chip .avatar { width: 34px; height: 34px; }
.profile-chip > span:last-child { display: flex; flex-direction: column; line-height: 1.3; }
.profile-chip strong { color: var(--text-primary); font-size: 0.82rem; }
.profile-chip small { font-size: 0.67rem; }
.main-content { width: 100%; flex: 1; padding: clamp(22px, 3vw, 42px); }
.app-footer { display: flex; justify-content: space-between; gap: 18px; padding: 18px clamp(22px, 3vw, 42px); border-top: 1px solid var(--border-soft); color: var(--text-muted); font-size: 0.75rem; }

.flash { position: relative; display: flex; align-items: center; gap: 11px; margin-bottom: 20px; padding: 13px 44px 13px 14px; border: 1px solid; border-radius: 13px; box-shadow: var(--shadow); }
.flash-success { color: #a7f3d0; border-color: rgba(16, 185, 129, 0.35); background: rgba(6, 78, 59, 0.55); }
.flash-error { color: #fecdd3; border-color: rgba(239, 68, 68, 0.35); background: rgba(127, 29, 29, 0.48); }
.flash-warning { color: #fde68a; border-color: rgba(245, 158, 11, 0.35); background: rgba(120, 53, 15, 0.48); }
.flash-mark { width: 27px; height: 27px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid currentColor; border-radius: 50%; font-weight: 900; }
.flash-close { position: absolute; top: 50%; left: 12px; width: 28px; height: 28px; padding: 0; border: 0; color: currentColor; background: transparent; cursor: pointer; transform: translateY(-50%); font-size: 1.3rem; }
.flash.fade-out { opacity: 0; transform: translateY(-8px); transition: 300ms ease; }

.page-heading-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading-row > div:first-child { min-width: 0; }
.page-heading-row h2 { margin-bottom: 7px; }
.page-heading-row p:last-child { max-width: 740px; }
.heading-actions, .welcome-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.title-with-badge { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.title-with-badge h2 { margin-bottom: 0; }

.panel { margin-bottom: 22px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: linear-gradient(145deg, rgba(17, 34, 56, 0.88), rgba(10, 22, 38, 0.9)); box-shadow: 0 12px 34px rgba(0, 0, 0, 0.12); }
.panel-header { min-height: 75px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 21px; border-bottom: 1px solid var(--border-soft); }
.panel-header h2 { margin: 0; font-size: 1.12rem; }
.panel-header .eyebrow { margin-bottom: 4px; }
.panel-note { color: var(--text-muted); font-size: 0.75rem; }
.form-panel { padding: clamp(20px, 3vw, 31px); }
.table-panel { overflow: hidden; }
.detail-panel { padding-bottom: 22px; }
.narrow-form { width: min(100%, 920px); }

.form-stack { display: grid; gap: 18px; }
.form-grid { display: grid; gap: 18px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-field { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.form-field label { color: #dfe7f2; font-size: 0.82rem; font-weight: 800; }
.form-field label span { color: var(--text-muted); font-size: 0.68rem; font-weight: 500; }
.form-field small { display: block; margin-top: 1px; font-size: 0.7rem; line-height: 1.5; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: none;
  color: var(--text-primary);
  background: rgba(4, 12, 22, 0.64);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
textarea { min-height: 105px; resize: vertical; }
select { cursor: pointer; }
select option { color: var(--text-primary); background: var(--surface); }
input::placeholder, textarea::placeholder { color: #54667e; }
input:focus, select:focus, textarea:focus { border-color: rgba(212, 175, 55, 0.7); background: rgba(7, 17, 31, 0.95); box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1); }
input:disabled, select:disabled, textarea:disabled { opacity: 0.6; cursor: not-allowed; }
.input-suffix { position: relative; display: flex; }
.input-suffix input { padding-left: 58px; }
.input-suffix > span { position: absolute; top: 50%; left: 11px; color: var(--text-muted); font-size: 0.75rem; pointer-events: none; transform: translateY(-50%); }
.input-suffix.compact input { min-width: 130px; }
.input-action-wrap { position: relative; }
.input-action-wrap input { padding-left: 64px; }
.input-action { position: absolute; top: 50%; left: 8px; padding: 4px 7px; border: 0; color: var(--gold-light); background: transparent; cursor: pointer; font-size: 0.72rem; font-weight: 800; transform: translateY(-50%); }
.form-section + .form-section { margin-top: 30px; padding-top: 30px; border-top: 1px solid var(--border-soft); }
.form-section-heading { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 22px; }
.form-section-heading > span { width: 35px; height: 35px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid rgba(212, 175, 55, 0.4); border-radius: 10px; color: var(--gold-light); background: rgba(212, 175, 55, 0.08); font-size: 0.75rem; font-weight: 900; }
.form-section-heading h3 { margin-bottom: 2px; }
.form-section-heading p { font-size: 0.78rem; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 25px; padding-top: 21px; border-top: 1px solid var(--border-soft); }
.readonly-value { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border: 1px solid var(--border-soft); border-radius: 11px; background: rgba(255, 255, 255, 0.025); }
.readonly-value a { color: var(--gold-light); font-size: 0.75rem; font-weight: 800; }
.notice-box { display: flex; align-items: flex-start; gap: 13px; margin-top: 19px; padding: 14px 16px; border: 1px solid rgba(56, 189, 248, 0.24); border-radius: 12px; background: var(--info-soft); }
.notice-box strong { flex: 0 0 auto; color: #bae6fd; }
.notice-box p { font-size: 0.78rem; }
.notice-box.warning { border-color: rgba(245, 158, 11, 0.26); background: var(--warning-soft); }
.notice-box.warning strong { color: #fde68a; }
.notice-box.success { border-color: rgba(16, 185, 129, 0.26); background: var(--success-soft); }
.notice-box.success strong { color: #a7f3d0; }
.notice-box.prominent { margin-bottom: 22px; }
.filter-panel { padding: 16px 18px; }
.filter-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.filter-form .form-field { flex: 0 1 170px; }
.filter-form .grow { flex: 1 1 260px; }
.compact-field { max-width: 180px; }
.filter-button { margin-bottom: 0; }

.welcome-card { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 23px; padding: clamp(24px, 4vw, 40px); border: 1px solid rgba(212, 175, 55, 0.2); border-radius: var(--radius-lg); background: linear-gradient(125deg, rgba(20, 42, 69, 0.95), rgba(10, 25, 43, 0.95)); box-shadow: var(--shadow); }
.welcome-card::before { content: ""; position: absolute; z-index: -1; top: -125px; left: -80px; width: 330px; height: 330px; border: 1px solid rgba(212, 175, 55, 0.16); border-radius: 50%; box-shadow: 0 0 0 45px rgba(212, 175, 55, 0.025), 0 0 0 90px rgba(212, 175, 55, 0.018); }
.welcome-card h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
.welcome-card p:last-child { max-width: 580px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { min-height: 148px; display: flex; align-items: center; gap: 15px; padding: 20px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: linear-gradient(145deg, rgba(17, 34, 56, 0.93), rgba(9, 21, 36, 0.9)); }
.stat-card.featured { border-color: rgba(212, 175, 55, 0.24); }
.stat-icon { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 14px; }
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.success { color: #6ee7b7; background: var(--success-soft); }
.stat-icon.info { color: #7dd3fc; background: var(--info-soft); }
.stat-icon.danger { color: #fda4af; background: var(--danger-soft); }
.stat-icon.gold { color: var(--gold-light); background: rgba(212, 175, 55, 0.12); }
.stat-card > div:last-child { min-width: 0; display: flex; flex-direction: column; }
.stat-card span, .mini-stat span { color: var(--text-secondary); font-size: 0.78rem; }
.stat-card strong { margin: 4px 0 2px; font-size: clamp(1.05rem, 2vw, 1.35rem); }
.stat-card small { font-size: 0.68rem; }
.stats-grid.compact { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.mini-stat { min-height: 104px; display: flex; flex-direction: column; justify-content: center; padding: 18px; border: 1px solid var(--border-soft); border-radius: 14px; background: rgba(13, 26, 43, 0.78); }
.mini-stat.featured { border-color: rgba(212, 175, 55, 0.28); background: linear-gradient(140deg, rgba(212, 175, 55, 0.1), rgba(13, 26, 43, 0.88)); }
.mini-stat strong { margin-top: 6px; font-size: 1.15rem; }
.quick-actions-section { margin-bottom: 22px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 14px; }
.section-heading h2 { margin-bottom: 0; font-size: 1.25rem; }
.quick-actions-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.quick-action { display: grid; grid-template-columns: 44px 1fr; column-gap: 12px; padding: 17px; border: 1px solid var(--border-soft); border-radius: 14px; background: rgba(13, 26, 43, 0.68); transition: transform var(--transition), border-color var(--transition), background var(--transition); }
.quick-action:hover { transform: translateY(-2px); border-color: rgba(212, 175, 55, 0.35); background: var(--surface-soft); }
.quick-action-icon { grid-row: 1 / span 2; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--gold-light); background: rgba(212, 175, 55, 0.1); }
.quick-action strong { align-self: end; }
.quick-action small { align-self: start; font-size: 0.69rem; }
.dashboard-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.dashboard-columns.uneven { grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.65fr); }
.activity-list { padding: 8px 15px 15px; }
.activity-item { display: flex; align-items: center; gap: 12px; padding: 13px 5px; border-bottom: 1px solid var(--border-soft); }
.activity-item:last-child { border-bottom: 0; }
.activity-item:hover .activity-copy strong { color: var(--gold-light); }
.activity-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.08); background: var(--success); }
.activity-dot.purchase { background: var(--info); box-shadow: 0 0 0 5px rgba(56, 189, 248, 0.08); }
.activity-copy { min-width: 0; display: flex; flex-direction: column; flex: 1; }
.activity-copy strong { transition: color var(--transition); }
.activity-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.69rem; }
.activity-value { display: flex; align-items: flex-end; flex-direction: column; gap: 4px; text-align: left; }
.activity-value strong { font-size: 0.82rem; }
.low-stock-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; padding: 17px 20px 20px; }
.low-stock-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px; border: 1px solid var(--border-soft); border-radius: 12px; background: rgba(4, 12, 22, 0.26); }
.low-stock-item:hover { border-color: rgba(245, 158, 11, 0.3); }
.low-stock-item > span:first-child { display: flex; flex-direction: column; }
.low-stock-item small { font-size: 0.68rem; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: right; }
th { padding: 12px 15px; color: var(--text-muted); background: rgba(4, 12, 22, 0.3); font-size: 0.68rem; font-weight: 900; letter-spacing: 0.025em; white-space: nowrap; }
td { padding: 14px 15px; border-top: 1px solid var(--border-soft); color: var(--text-secondary); vertical-align: middle; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(255, 255, 255, 0.018); }
td strong { color: var(--text-primary); }
.table-primary { color: var(--text-primary); font-weight: 800; }
.table-primary:hover { color: var(--gold-light); }
.table-sub { display: block; margin-top: 3px; font-size: 0.66rem; }
.table-actions { width: 55px; text-align: left; }
.row-muted { opacity: 0.52; }
.row-muted td { text-decoration-color: rgba(255, 255, 255, 0.16); }
.compact-table td, .compact-table th { padding: 11px 13px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-height: 25px; padding: 3px 9px; border: 1px solid transparent; border-radius: 999px; font-size: 0.67rem; font-weight: 900; white-space: nowrap; }
.badge-success { color: #a7f3d0; border-color: rgba(16, 185, 129, 0.27); background: var(--success-soft); }
.badge-danger { color: #fecdd3; border-color: rgba(239, 68, 68, 0.27); background: var(--danger-soft); }
.badge-warning { color: #fde68a; border-color: rgba(245, 158, 11, 0.27); background: var(--warning-soft); }
.badge-info { color: #bae6fd; border-color: rgba(56, 189, 248, 0.27); background: var(--info-soft); }
.badge-muted, .badge-neutral { color: var(--text-secondary); border-color: var(--border); background: rgba(148, 163, 184, 0.07); }
.empty-state { max-width: 520px; margin: 0 auto; padding: 46px 25px; text-align: center; }
.empty-icon { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 16px; border: 1px solid rgba(212, 175, 55, 0.25); border-radius: 17px; color: var(--gold-light); background: rgba(212, 175, 55, 0.08); }
.empty-icon svg { width: 26px; height: 26px; }
.empty-state h3 { margin-bottom: 8px; font-size: 1.15rem; }
.empty-state p { margin-bottom: 20px; }
.simple-empty { padding: 35px 20px; color: var(--text-muted); text-align: center; }
.positive-empty { display: flex; align-items: center; justify-content: center; gap: 13px; padding: 28px; }
.positive-empty > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: #a7f3d0; background: var(--success-soft); font-size: 1.2rem; font-weight: 900; }
.positive-empty strong { display: block; margin-bottom: 2px; }
.positive-empty p { font-size: 0.78rem; }
.details-list { margin: 0; padding: 4px 22px; }
.details-list > div { display: grid; grid-template-columns: 105px 1fr; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border-soft); }
.details-list > div:last-child { border-bottom: 0; }
.details-list dt { color: var(--text-muted); font-size: 0.72rem; }
.details-list dd { margin: 0; color: var(--text-primary); overflow-wrap: anywhere; }
.danger-zone { margin: 20px 20px 0; padding: 16px; border: 1px solid rgba(239, 68, 68, 0.2); border-radius: 13px; background: rgba(239, 68, 68, 0.045); }
.danger-zone h3 { color: #fecdd3; }
.danger-zone p { margin-bottom: 13px; font-size: 0.75rem; }

.balance-hero { min-height: 145px; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 22px; padding: 28px; border: 1px solid var(--border-soft); border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--surface-soft), var(--surface)); }
.balance-hero.due { border-color: rgba(245, 158, 11, 0.28); background: linear-gradient(135deg, rgba(120, 53, 15, 0.26), rgba(13, 26, 43, 0.92)); }
.balance-hero.credit { border-color: rgba(16, 185, 129, 0.28); background: linear-gradient(135deg, rgba(6, 78, 59, 0.26), rgba(13, 26, 43, 0.92)); }
.balance-hero > div { display: flex; flex-direction: column; }
.balance-hero p { font-size: 0.8rem; }
.balance-hero strong { margin: 5px 0; font-size: clamp(1.7rem, 4vw, 2.5rem); }
.balance-hero svg { width: 62px; height: 62px; color: var(--gold-light); opacity: 0.65; }

.invoice-form { display: block; }
.invoice-items-panel { overflow: hidden; }
.invoice-table-wrap { overflow-x: auto; }
.invoice-entry-table { min-width: 880px; }
.invoice-entry-table th:nth-child(1) { width: 32%; }
.invoice-entry-table td { padding: 11px 10px; }
.invoice-entry-table input, .invoice-entry-table select { min-height: 40px; }
.product-cell select { min-width: 230px; }
.stock-hint { color: var(--text-muted); font-size: 0.73rem; white-space: nowrap; }
.line-total { white-space: nowrap; }
.invoice-footer-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr); gap: 22px; }
.invoice-totals-card { padding: 22px; }
.totals-row, .totals-input-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 51px; border-bottom: 1px solid var(--border-soft); }
.totals-row > span, .totals-input-row label { color: var(--text-secondary); }
.totals-input-row .input-suffix { width: 165px; }
.totals-input-row input { min-height: 38px; }
.totals-row.grand { margin: 8px -8px; padding: 8px; border: 1px solid rgba(212, 175, 55, 0.2); border-radius: 11px; background: rgba(212, 175, 55, 0.07); }
.totals-row.grand strong { color: var(--gold-light); font-size: 1.2rem; }
.totals-row.due strong { color: var(--warning); }
.invoice-submit { margin-top: 15px; }
.invoice-document { overflow: hidden; }
.invoice-document-header { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 27px; border-bottom: 1px solid var(--border-soft); background: rgba(4, 12, 22, 0.22); }
.invoice-brand { display: flex; align-items: center; gap: 13px; }
.invoice-brand img { width: 66px; height: 66px; }
.invoice-brand > div { display: flex; flex-direction: column; }
.invoice-brand strong { color: var(--gold-light); font-size: 1.3rem; }
.invoice-brand span { color: var(--text-secondary); }
.invoice-meta { display: flex; align-items: flex-end; flex-direction: column; }
.invoice-meta span { color: var(--text-secondary); }
.invoice-meta strong { margin: 4px 0; font-size: 1.25rem; }
.invoice-party-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--border-soft); }
.invoice-party-grid > div { display: flex; flex-direction: column; padding: 15px 21px; background: var(--surface); }
.invoice-party-grid span { color: var(--text-muted); font-size: 0.7rem; }
.invoice-party-grid strong { margin-top: 3px; }
.invoice-view-table { padding: 17px 20px 5px; }
.invoice-document-footer { display: grid; grid-template-columns: 1fr minmax(300px, 0.55fr); gap: 30px; padding: 24px; }
.invoice-notes > span { color: var(--text-muted); font-size: 0.73rem; }
.invoice-notes p { margin-top: 8px; white-space: pre-line; }
.invoice-summary { border: 1px solid var(--border-soft); border-radius: 12px; overflow: hidden; }
.invoice-summary > div { display: flex; justify-content: space-between; gap: 18px; padding: 10px 13px; border-bottom: 1px solid var(--border-soft); }
.invoice-summary > div:last-child { border-bottom: 0; }
.invoice-summary span { color: var(--text-secondary); }
.invoice-summary .grand { background: rgba(212, 175, 55, 0.08); }
.invoice-summary .grand strong { color: var(--gold-light); }
.invoice-summary .due strong { color: var(--warning); }
.canceled-banner { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 21px; padding: 14px 18px; border: 1px solid rgba(239, 68, 68, 0.32); border-radius: 13px; color: #fecdd3; background: var(--danger-soft); }
.canceled-banner span { color: #fda4af; font-size: 0.76rem; }
.cancel-panel { display: grid; grid-template-columns: minmax(250px, 0.8fr) minmax(420px, 1.2fr); align-items: end; gap: 28px; padding: 22px; }
.cancel-panel h2 { font-size: 1.15rem; }
.cancel-form { display: flex; align-items: flex-end; gap: 12px; }

.report-hero-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.report-hero-card { min-height: 145px; display: flex; flex-direction: column; justify-content: center; padding: 22px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: linear-gradient(145deg, var(--surface-soft), var(--surface)); }
.report-hero-card.primary { border-color: rgba(212, 175, 55, 0.35); background: linear-gradient(135deg, rgba(212, 175, 55, 0.14), var(--surface)); }
.report-hero-card span { color: var(--text-secondary); }
.report-hero-card strong { margin: 7px 0 5px; font-size: 1.5rem; }
.report-hero-card.primary strong { color: var(--gold-light); font-size: 1.8rem; }
.report-hero-card small { line-height: 1.5; }
.daily-bars { max-height: 570px; overflow: auto; padding: 15px 20px 20px; }
.daily-bar-row { display: grid; grid-template-columns: 94px minmax(100px, 1fr) minmax(240px, 1.2fr); align-items: center; gap: 13px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.daily-date { color: var(--text-secondary); font-size: 0.72rem; }
.daily-bar-track { height: 8px; overflow: hidden; border-radius: 999px; background: rgba(148, 163, 184, 0.1); }
.daily-bar-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold-dark), var(--gold-light)); }
.daily-values { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; font-size: 0.68rem; }
.rank-list { padding: 8px 16px 16px; }
.rank-item { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 11px; padding: 13px 4px; border-bottom: 1px solid var(--border-soft); }
.rank-item:last-child { border-bottom: 0; }
.rank-number { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(212, 175, 55, 0.23); border-radius: 9px; color: var(--gold-light); background: rgba(212, 175, 55, 0.07); font-weight: 900; }
.rank-copy, .rank-value { display: flex; flex-direction: column; }
.rank-value { align-items: flex-end; }
.rank-copy small, .rank-value small { font-size: 0.67rem; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr); gap: 22px; }
.settings-side-stack { display: grid; align-content: start; gap: 22px; }
.settings-side-stack .panel { margin-bottom: 0; }
.backup-panel { display: flex; align-items: center; justify-content: space-between; gap: 25px; padding: 24px; }

.error-state { display: flex; align-items: center; flex-direction: column; justify-content: center; min-height: 55vh; padding: 40px; text-align: center; }
.error-state > span { color: var(--gold-light); font-size: clamp(4rem, 12vw, 8rem); font-weight: 900; line-height: 1; opacity: 0.22; }
.error-state h2 { margin-top: -10px; }
.error-state p { margin-bottom: 22px; }

.print-body { color: #162033; background: #eef1f5; font-family: Tahoma, "Segoe UI", Arial, sans-serif; }
.print-invoice { width: min(210mm, calc(100% - 30px)); min-height: 275mm; margin: 18px auto 90px; padding: 16mm; background: #fff; box-shadow: 0 15px 45px rgba(0, 0, 0, 0.16); }
.print-invoice-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 25px; padding-bottom: 20px; border-bottom: 3px solid #c49b28; }
.print-brand { display: flex; align-items: center; gap: 14px; }
.print-brand img { width: 72px; height: 72px; }
.print-brand h1 { margin: 0 0 2px; color: #8c6817; font-size: 1.65rem; }
.print-brand p { color: #475569; }
.print-brand span { display: block; color: #64748b; font-size: 0.75rem; }
.print-title { display: flex; align-items: flex-end; flex-direction: column; }
.print-title p { color: #64748b; }
.print-title h2 { margin: 2px 0; color: #0f172a; }
.print-title > span { color: #64748b; font-size: 0.78rem; }
.print-status { margin-top: 8px; padding: 4px 9px; border: 1px solid #cbd5e1; border-radius: 999px; }
.print-party { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin: 22px 0; padding: 15px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; }
.print-party > div { display: flex; flex-direction: column; }
.print-party span { color: #64748b; font-size: 0.7rem; }
.print-table { color: #1e293b; }
.print-table th { color: #475569; background: #f1f5f9; }
.print-table td { border-color: #e2e8f0; color: #334155; }
.print-footer-grid { display: grid; grid-template-columns: 1fr 280px; gap: 30px; margin-top: 28px; }
.print-notes h3 { color: #475569; }
.print-notes p { color: #64748b; white-space: pre-line; }
.print-summary { border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; }
.print-summary > div { display: flex; justify-content: space-between; padding: 9px 12px; border-bottom: 1px solid #e2e8f0; }
.print-summary > div:last-child { border-bottom: 0; }
.print-summary .grand { color: #795c14; background: #fff9e6; }
.print-canceled { margin-top: 16px; padding: 10px; border: 1px solid #fca5a5; border-radius: 8px; color: #991b1b; background: #fef2f2; }
.print-invoice-footer { margin-top: 48px; padding-top: 15px; border-top: 1px solid #e2e8f0; text-align: center; }
.print-invoice-footer p { color: #8c6817; font-weight: 800; }
.print-invoice-footer span { color: #94a3b8; font-size: 0.7rem; }
.print-actions { position: fixed; z-index: 10; right: 50%; bottom: 18px; display: flex; gap: 10px; padding: 10px; border-radius: 14px; background: rgba(7, 17, 31, 0.93); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28); transform: translateX(50%); }

@media (max-width: 1250px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-hero-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cancel-panel { grid-template-columns: 1fr; }
}

@media (max-width: 1040px) {
  :root { --sidebar-width: 258px; }
  .dashboard-columns, .dashboard-columns.uneven, .settings-grid { grid-template-columns: 1fr; }
  .invoice-footer-grid { grid-template-columns: 1fr; }
  .settings-side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .date-pill { display: none; }
}

@media (max-width: 860px) {
  .sidebar { width: min(310px, 88vw); transform: translateX(105%); transition: transform 220ms ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: inline-flex; }
  .sidebar-overlay { position: fixed; z-index: 55; inset: 0; display: block; visibility: hidden; opacity: 0; background: rgba(0, 0, 0, 0.58); backdrop-filter: blur(3px); transition: opacity 220ms ease, visibility 220ms; }
  .sidebar-overlay.open { visibility: visible; opacity: 1; }
  .app-frame { margin-right: 0; }
  .menu-button { display: inline-flex; }
  .topbar { min-height: 80px; }
  .profile-chip > span:last-child { display: none; }
  .profile-chip { padding: 5px; border: 0; background: transparent; }
  .public-shell { grid-template-columns: 1fr; }
  .public-brand-panel { min-height: 310px; padding: 35px 25px; border-left: 0; border-bottom: 1px solid rgba(212, 175, 55, 0.18); }
  .public-logo { width: 115px; height: 115px; margin-bottom: 17px; }
  .public-brand-inner h1 { font-size: 2.5rem; }
  .public-form-panel { padding: 24px; }
  .form-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-document-footer { grid-template-columns: 1fr; }
  .daily-bar-row { grid-template-columns: 85px 1fr; }
  .daily-values { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 680px) {
  body { font-size: 13px; }
  .main-content { padding: 18px 14px 28px; }
  .topbar { padding: 13px 14px; }
  .topbar-leading h1 { max-width: 190px; font-size: 1.1rem; }
  .topbar-leading .eyebrow { display: none; }
  .app-footer { padding: 15px; }
  .page-heading-row, .welcome-card, .backup-panel { align-items: flex-start; flex-direction: column; }
  .heading-actions, .welcome-actions { width: 100%; }
  .heading-actions .button, .welcome-actions .button { flex: 1; }
  .stats-grid, .report-hero-grid, .quick-actions-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 110px; }
  .form-grid.two, .form-grid.three, .form-grid.four, .settings-side-stack { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
  .filter-form .form-field, .filter-form .grow, .compact-field { flex-basis: 100%; max-width: none; }
  .filter-button { flex: 1; }
  .panel-header { align-items: flex-start; flex-direction: column; min-height: auto; }
  .panel-header .text-link { align-self: flex-start; }
  .invoice-party-grid { grid-template-columns: 1fr; }
  .invoice-document-header { align-items: flex-start; flex-direction: column; }
  .invoice-meta { align-items: flex-start; }
  .cancel-form { align-items: stretch; flex-direction: column; }
  .cancel-form .button { width: 100%; }
  .canceled-banner { align-items: flex-start; flex-direction: column; }
  .details-list > div { grid-template-columns: 85px 1fr; }
  .balance-hero { min-height: 120px; padding: 20px; }
  .balance-hero svg { width: 42px; height: 42px; }
  .activity-value .badge { display: none; }
  .rank-item { grid-template-columns: 32px 1fr; }
  .rank-value { grid-column: 2; align-items: flex-start; }
  .public-form-panel { padding: 15px; }
  .auth-card { padding: 23px 18px; border-radius: 20px; }
  .public-brand-panel { min-height: 250px; }
  .brand-features { display: none; }
  .print-invoice { width: calc(100% - 14px); padding: 7mm; }
  .print-invoice-header, .print-footer-grid { grid-template-columns: 1fr; flex-direction: column; }
  .print-title { align-items: flex-start; }
  .print-party { grid-template-columns: 1fr; }
}

@media print {
  @page { size: A4; margin: 8mm; }
  body.print-body { background: #fff; }
  .print-invoice { width: 100%; min-height: auto; margin: 0; padding: 4mm; box-shadow: none; }
  .no-print { display: none !important; }
  .print-table th, .print-table td { padding: 7px 9px; }
}

/* بطاقة معلومات الاتصال بالشبكة — تظهر أسفل شاشة الدخول على الجهاز الرئيسي */
.lan-hint { width: min(100%, 680px); margin-top: 16px; padding: 16px 20px; border: 1px solid rgba(242, 179, 61, 0.35);
            border-radius: 16px; background: rgba(242, 179, 61, 0.08); color: #d7e4ee; font-size: 13px; line-height: 1.9; }
.lan-hint-title { color: #f2b33d; font-weight: 700; margin-bottom: 4px; }
.lan-hint-addr { margin-top: 6px; font-weight: 700; color: #8ce8d8; font-size: 15px; letter-spacing: 0.4px;
                 background: rgba(0, 168, 150, 0.14); border-radius: 10px; padding: 6px 12px; display: inline-block; }
