@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");

:root {
  --mx-primary: #0a1931;
  --mx-primary-dark: #132845;
  --mx-accent: #ffb01f;
  --mx-accent-dark: #e89500;
  --mx-highlight: #ffb01f;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f3f5f8;
  --text: #0a1931;
  --muted: #6b7280;
  --soft: #9ca3af;
  --border: #e6e8ec;
  --border-soft: #eff0f2;
  --success: #047857;
  --danger: #b91c1c;
  --warning: #a16207;
  --info: #1d4ed8;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.04);
  --shadow-hover: 0 6px 24px rgba(16, 24, 40, 0.09), 0 1px 2px rgba(16, 24, 40, 0.04);
  --sidebar-width: 296px;
}

.dark {
  --bg: #0d1420;
  --surface: #151f2f;
  --surface-2: #101927;
  --surface-3: #1d2939;
  --text: #f3f5f8;
  --muted: #aab2bf;
  --soft: #7e8999;
  --border: #2a3749;
  --border-soft: #233044;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.18);
  --shadow-hover: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.theme-construction {
  --mx-primary: #203995;
  --mx-primary-dark: #162a75;
  --mx-accent: #03a6ee;
  --mx-accent-dark: #0288c7;
  --mx-highlight: #e30d0d;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #eef5fb;
  --text: #13204e;
  --muted: #64748b;
  --soft: #94a3b8;
  --border: #dce5ef;
  --border-soft: #eaf0f6;
  --info: #1769aa;
  --shadow-sm: 0 1px 2px rgba(20, 49, 106, 0.05);
  --shadow: 0 1px 2px rgba(20, 49, 106, 0.05), 0 8px 24px rgba(20, 49, 106, 0.05);
  --shadow-hover: 0 6px 24px rgba(20, 49, 106, 0.11), 0 1px 2px rgba(20, 49, 106, 0.05);
}

* { box-sizing: border-box; }
html { color-scheme: light; -webkit-tap-highlight-color: transparent; }
html.dark { color-scheme: dark; }
html.theme-construction { color-scheme: light; }
body { margin: 0; background: var(--bg); color: var(--text); font: 500 13px/1.5 "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif; letter-spacing: 0; }
body.menu-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
img { max-width: 100%; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: 22px; font-weight: 800; line-height: 1.15; }
h2 { margin-bottom: 16px; font-size: 15px; font-weight: 800; line-height: 1.3; }
h3 { font-size: 14px; font-weight: 750; }
p { color: var(--muted); }
small, .hint { color: var(--muted); }
.eyebrow { display: block; margin-bottom: 4px; color: var(--mx-accent-dark); font-size: 9px; font-weight: 800; text-transform: uppercase; }
code { white-space: pre-wrap; overflow-wrap: anywhere; }
svg { display: block; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { border-radius: 999px; background: #d1d5db; }

input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  padding: 9px 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
input::placeholder, textarea::placeholder { color: var(--soft); }
textarea { min-height: 94px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: color-mix(in srgb, var(--mx-accent) 70%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mx-accent) 18%, transparent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--mx-primary); box-shadow: none; }
input[type="file"] { padding: 6px 8px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; width: var(--sidebar-width); padding-right: 0; color: #fff; }
.sidebar-inner { position: relative; height: 100%; display: flex; flex-direction: column; overflow: hidden; border-radius: 0 28px 28px 0; background: var(--mx-primary); box-shadow: 8px 0 32px rgba(10, 25, 49, 0.18); }
.sidebar-brand { min-height: 94px; display: flex; align-items: center; gap: 8px; padding: 16px 18px 15px 22px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.brand { min-width: 0; flex: 1; display: flex; align-items: center; gap: 12px; }
.brand img, .brand-mark { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; }
.brand img { object-fit: contain; padding: 4px; background: #fff; }
.brand-mark { display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, 0.48); background: var(--mx-accent); color: var(--mx-primary); box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.55), 0 4px 16px rgba(255, 176, 31, 0.3); font-size: 16px; font-weight: 800; }
.brand-copy { min-width: 0; }
.brand-copy strong { display: -webkit-box; overflow: hidden; color: #fff; font-size: 13px; font-weight: 800; line-height: 1.25; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.brand-copy span { display: block; margin-top: 3px; overflow: hidden; color: rgba(255, 255, 255, 0.47); font-size: 9px; font-weight: 700; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.brand-logo-link { gap: 8px; }
.brand img.brand-logo { width: 158px; height: 59px; flex: 0 1 158px; padding: 5px 7px; border-radius: 8px; object-fit: contain; }
.brand-panel-label { flex: 0 0 auto; color: rgba(255, 255, 255, 0.58); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 20px 12px; }
.nav-group + .nav-group { margin-top: 21px; }
.nav-section { margin: 0 12px 8px; color: rgba(255, 255, 255, 0.34); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.sidebar nav a { position: relative; min-height: 39px; display: flex; align-items: center; gap: 12px; margin-bottom: 2px; padding: 8px 12px; border-radius: 11px; color: rgba(255, 255, 255, 0.68); font-size: 12px; font-weight: 600; transition: 0.2s ease; }
.sidebar nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.sidebar nav a.active { background: #fff; color: var(--mx-primary); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.12); }
.sidebar nav a.active::before { content: ""; position: absolute; left: -1px; top: 50%; width: 3px; height: 18px; border-radius: 999px; background: var(--mx-accent); transform: translateY(-50%); }
.sidebar nav a svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: 0.78; stroke-width: 1.8; }
.sidebar nav a.active svg { opacity: 1; }
.sidebar nav a span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar nav a b { min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 10px; font-style: normal; }
.sidebar nav a b.hot { background: var(--mx-accent); color: var(--mx-primary); }
.sidebar nav a.active b { background: var(--mx-primary); color: #fff; }
.sidebar nav a em { padding: 2px 5px; border-radius: 5px; background: var(--mx-accent); color: var(--mx-primary); font-size: 8px; font-style: normal; font-weight: 800; }
.sidebar-footer { margin-top: auto; padding: 12px; }
.sidebar-profile { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 14px; background: rgba(255, 255, 255, 0.06); color: #fff; }
.avatar { position: relative; width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border-radius: 10px; background: var(--mx-accent); color: var(--mx-primary); font-size: 11px; font-weight: 800; }
.avatar i { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border: 2px solid var(--mx-primary); border-radius: 50%; background: #34d399; }
.avatar.small { width: 36px; height: 36px; flex-basis: 36px; border: 1px solid var(--border); border-radius: 11px; }
.profile-copy { min-width: 0; flex: 1; }
.profile-copy strong, .profile-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy strong { color: #fff; font-size: 12px; }
.profile-copy small { margin-top: 2px; color: rgba(255, 255, 255, 0.52); font-size: 10px; }
.sidebar-profile > svg { width: 16px; height: 16px; opacity: 0.65; }
.sidebar-footer form { margin-top: 8px; }
.sidebar-logout { width: 100%; height: 37px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 11px; background: transparent; color: rgba(255, 255, 255, 0.62); font-size: 12px; font-weight: 700; }
.sidebar-logout:hover { border-color: rgba(255, 255, 255, 0.26); background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar-logout svg { width: 14px; height: 14px; }
.sidebar-meta { display: flex; justify-content: space-between; gap: 6px; margin-top: 11px; padding: 0 3px; color: rgba(255, 255, 255, 0.24); font-size: 8px; }
.sidebar-overlay { display: none; }

.main { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 30; height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 32px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(18px); }
.topbar-title { min-width: 0; display: flex; align-items: center; gap: 14px; }
.title-line { display: flex; align-items: center; gap: 9px; }
.title-line h1 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-pill { height: 22px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border-radius: 999px; background: var(--mx-primary); color: #fff; font-size: 10px; font-weight: 700; }
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.12); }
.breadcrumb { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--muted); font-size: 10px; }
.breadcrumb b { color: var(--border); }
.breadcrumb strong { color: var(--text); }
.breadcrumb em { margin-left: 5px; padding: 2px 7px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font-style: normal; }
.topbar-actions { min-width: 0; display: flex; align-items: center; gap: 8px; }
.global-search { width: min(300px, 28vw); height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); }
.global-search > svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--soft); }
.global-search input { min-height: 0; padding: 0; border: 0; background: transparent; box-shadow: none; font-size: 11px; }
.global-search input:focus { box-shadow: none; }
.icon-button { position: relative; width: 38px; height: 38px; flex: 0 0 38px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.icon-button:hover { border-color: color-mix(in srgb, var(--mx-primary) 18%, var(--border)); box-shadow: 0 4px 12px rgba(16, 24, 40, 0.08); }
.icon-button.danger { border-color: #fecaca; background: #fee2e2; color: var(--danger); }
.icon-button svg { width: 18px; height: 18px; }
.icon-button b { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--bg); border-radius: 999px; background: var(--mx-accent); color: var(--mx-primary); font-size: 9px; }
.topbar-divider { width: 1px; height: 24px; margin: 0 3px; background: var(--border); }
.topbar-user { display: flex; align-items: center; gap: 8px; }
.topbar-user > span:last-child { line-height: 1.2; }
.topbar-user strong, .topbar-user small { display: block; }
.topbar-user strong { font-size: 11px; }
.topbar-user small { margin-top: 2px; font-size: 9px; }

.content { width: min(100%, 1680px); min-height: calc(100vh - 68px); margin: 0 auto; padding: 24px 32px; }
.system-banner { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding: 12px 15px; border: 1px solid var(--border); border-left: 3px solid var(--mx-primary); border-radius: 14px; background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-sm); }
.system-banner.danger { border-color: #fecaca; border-left-color: #ef4444; background: #fff1f2; color: #7f1d1d; }
.system-banner .banner-icon { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-3); }
.system-banner.danger .banner-icon { border-color: #fecaca; background: #fee2e2; }
.system-banner svg { width: 16px; height: 16px; }
.system-banner > div { min-width: 0; flex: 1; }
.system-banner strong { display: block; }
.system-banner p { margin: 2px 0 0; color: inherit; font-size: 11px; }
.system-banner form { flex: 0 0 auto; }
.dark .system-banner.danger { border-color: #7f1d1d; background: #32151b; color: #fecaca; }

.panel { margin-bottom: 20px; padding: 20px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.panel-head, .panel-subhead { min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h2, .panel-subhead h2, .panel-head p { margin: 0; }
.panel-head > div > p { margin: 3px 0 0; font-size: 11px; }
.panel-subhead { min-height: 32px; }
.panel-subhead strong { font-size: 13px; }
.quick-actions, .toolbar, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.quick-actions { margin-bottom: 18px; }
.toolbar > input, .toolbar > select { width: auto; min-width: 180px; flex: 1; }
.toolbar > label { min-width: 155px; }
.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 15px; border: 1px solid transparent; border-radius: 11px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 750; white-space: nowrap; transition: 0.18s ease; }
.button svg { width: 15px; height: 15px; }
.button:hover { transform: translateY(-1px); box-shadow: 0 5px 14px rgba(16, 24, 40, 0.09); }
.button.primary { background: var(--mx-primary); color: #fff; box-shadow: 0 8px 20px rgba(10, 25, 49, 0.18); }
.button.primary:hover { background: var(--mx-primary-dark); }
.button.accent { background: var(--mx-accent); color: var(--mx-primary); box-shadow: 0 8px 20px color-mix(in srgb, var(--mx-accent) 24%, transparent); }
.button.accent:hover { background: var(--mx-accent-dark); color: var(--mx-primary); }
.button.ghost { border-color: var(--border); background: var(--surface); }
.button.danger { border-color: #fecaca; background: #fee2e2; color: var(--danger); }
.button.tiny { min-height: 31px; padding: 5px 9px; border-radius: 9px; font-size: 10px; }
.button.full { width: 100%; }

.cards { display: grid; grid-template-columns: repeat(5, minmax(145px, 1fr)); gap: 14px; margin-bottom: 20px; }
.cards.compact { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.cards.compact .metric { min-height: 118px; }
.metric { position: relative; min-height: 144px; display: flex; flex-direction: column; justify-content: space-between; padding: 16px; overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); transition: 0.25s ease; }
.metric:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--mx-primary) 12%, var(--border)); box-shadow: var(--shadow-hover); }
.metric > span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.metric > strong { color: var(--text); font-size: 27px; font-weight: 800; overflow-wrap: anywhere; }
.metric.highlight { border-color: var(--mx-primary-dark); background: var(--mx-primary); color: #fff; box-shadow: 0 12px 32px rgba(10, 25, 49, 0.25); }
.metric.highlight > span { color: rgba(255, 255, 255, 0.55); }
.metric.highlight > strong { color: var(--mx-accent); }
.metric-icon { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-3); color: var(--text); }
.metric-icon svg { width: 18px; height: 18px; }
.metric.highlight .metric-icon { border: 0; background: var(--mx-accent); color: var(--mx-primary); }
.metric-caption { color: var(--muted); font-size: 10px; }
.metric.highlight .metric-caption { color: rgba(255, 255, 255, 0.52); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-grid.wide { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid h2, .form-grid .full { grid-column: 1 / -1; }
.logo-setting { min-width: 0; display: flex; align-items: center; gap: 18px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.logo-preview { width: 270px; height: 102px; flex: 0 0 270px; display: grid; place-items: center; padding: 12px; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.logo-upload { min-width: 0; flex: 1; color: var(--text); }
.logo-upload > span { color: var(--muted); font-size: 10px; font-weight: 500; }
.theme-picker { min-width: 0; margin: 0; padding: 0; border: 0; }
.theme-picker legend { margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.theme-option { position: relative; min-width: 0; min-height: 74px; display: grid; grid-template-columns: 54px minmax(0, 1fr); align-items: center; gap: 11px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer; transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease; }
.theme-option:hover { border-color: color-mix(in srgb, var(--mx-primary) 28%, var(--border)); background: var(--surface-2); }
.theme-option:has(input:checked) { border-color: var(--mx-primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--mx-primary) 14%, transparent); }
.theme-option input { position: absolute; width: 1px; min-height: 1px; opacity: 0; }
.theme-option > span:last-child { min-width: 0; }
.theme-option strong, .theme-option small { display: block; }
.theme-option strong { color: var(--text); font-size: 11px; }
.theme-option small { margin-top: 3px; font-size: 9px; font-weight: 500; line-height: 1.35; }
.theme-swatch { width: 54px; height: 40px; display: grid; grid-template-columns: 1.4fr 1fr 0.65fr; overflow: hidden; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.theme-swatch i { display: block; }
.swatch-light i:nth-child(1) { background: #0a1931; }
.swatch-light i:nth-child(2) { background: #ffb01f; }
.swatch-light i:nth-child(3) { background: #f6f7f9; }
.swatch-dark i:nth-child(1) { background: #0d1420; }
.swatch-dark i:nth-child(2) { background: #1d2939; }
.swatch-dark i:nth-child(3) { background: #ffb01f; }
.swatch-construction i:nth-child(1) { background: #203995; }
.swatch-construction i:nth-child(2) { background: #03a6ee; }
.swatch-construction i:nth-child(3) { background: #e30d0d; }
.inline { min-height: 42px; display: flex; align-items: center; gap: 8px; }
.inline input { width: auto; min-height: auto; }
.inline-form { display: flex; align-items: center; gap: 6px; }
.inline-form input { min-width: 120px; min-height: 31px; }
.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 0; }
dt { color: var(--muted); font-size: 11px; font-weight: 700; }
dd { margin: 0; font-weight: 700; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { height: 52px; padding: 9px 13px; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: middle; }
th { height: 36px; background: var(--surface-2); color: var(--soft); font-size: 9px; font-weight: 800; text-transform: uppercase; white-space: nowrap; }
tbody tr { transition: background 0.15s ease; }
tbody tr:hover { background: color-mix(in srgb, var(--mx-primary) 3%, var(--surface)); }
td code { font-size: 10px; }
.pill { min-height: 24px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 10px; font-weight: 750; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.7; }
.pill.ok { border-color: #a7f3d0; background: #ecfdf5; color: var(--success); }
.pill.warn { border-color: #fde68a; background: #fffbeb; color: var(--warning); }
.pill.danger { border-color: #fecaca; background: #fef2f2; color: var(--danger); }
.pill.muted { color: var(--muted); }
.dark .pill.ok { border-color: #065f46; background: #092a22; }
.dark .pill.warn { border-color: #854d0e; background: #2b220b; }
.dark .pill.danger { border-color: #7f1d1d; background: #32151b; }

.flash { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 11px 14px; border: 1px solid #a7f3d0; border-left: 3px solid #10b981; border-radius: 13px; background: #ecfdf5; color: #065f46; box-shadow: var(--shadow-sm); }
.flash svg { width: 17px; height: 17px; flex: 0 0 17px; }
.flash.error { border-color: #fecaca; border-left-color: #ef4444; background: #fff1f2; color: #7f1d1d; }
.dark .flash { border-color: #065f46; background: #092a22; color: #a7f3d0; }
.dark .flash.error { border-color: #7f1d1d; background: #32151b; color: #fecaca; }
.list { display: grid; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 8px; border-bottom: 1px solid var(--border-soft); color: var(--text); }
.list-row a { min-width: 0; flex: 1; color: var(--text); }
.list-row strong, .list-row span { display: block; }
.list-row span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.list-row.read { opacity: 0.6; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.9fr); gap: 20px; }
.dashboard-side { display: grid; align-content: start; gap: 20px; }
.dashboard-side .panel { margin: 0; }
.customer-cell { display: flex; align-items: center; gap: 10px; }
.customer-initials { width: 29px; height: 29px; flex: 0 0 29px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--mx-accent) 28%, transparent); border-radius: 9px; background: color-mix(in srgb, var(--mx-accent) 15%, transparent); color: var(--mx-primary); font-size: 9px; font-weight: 800; }
.record-count { padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 9px; font-weight: 700; }
.notification-item { display: flex; gap: 11px; padding: 12px 4px; border-bottom: 1px solid var(--border-soft); }
.notification-item:last-child { border: 0; }
.notification-icon { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border: 1px solid #c7d9ff; border-radius: 10px; background: #eef4ff; color: var(--info); }
.notification-icon svg { width: 15px; height: 15px; }
.notification-item strong { display: block; font-size: 11px; }
.notification-item span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.empty-state { padding: 26px; color: var(--muted); text-align: center; }

.quote-items { display: grid; gap: 8px; }
.quote-row { display: grid; grid-template-columns: minmax(200px, 2fr) 0.8fr 0.7fr 0.8fr 0.5fr 0.7fr 0.8fr auto; gap: 7px; align-items: center; padding: 9px; border: 1px solid var(--border-soft); border-radius: 13px; background: var(--surface-2); }
.quote-row input, .quote-row select { background: var(--surface); }
.item-total { font-weight: 800; color: var(--text); text-align: right; white-space: nowrap; }
.quote-summary { display: flex; justify-content: flex-end; gap: 22px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-2); }
.quote-summary span { color: var(--muted); font-size: 11px; }
.quote-summary strong { margin-left: 4px; color: var(--text); }
.quote-summary span:last-child strong { color: var(--mx-primary); font-size: 17px; }
.dark .quote-summary span:last-child strong { color: var(--mx-accent); }
dialog { width: min(100% - 24px, 680px); max-width: 680px; padding: 22px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: 0 28px 70px rgba(0, 0, 0, 0.34); }
dialog::backdrop { background: rgba(10, 25, 49, 0.58); backdrop-filter: blur(3px); }
#floor-result { grid-column: 1 / -1; min-height: 58px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); }

.template-grid, .offer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.template-card, .offer-card { overflow: hidden; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.template-card > h3, .template-card > p, .offer-card > div:last-child { margin: 0; padding: 14px; }
.template-preview { aspect-ratio: 1 / 1; display: grid; place-content: center; gap: 10px; padding: 24px; background: #eef4ff; color: var(--mx-primary); text-align: center; }
.template-preview strong { font-size: 30px; color: var(--mx-primary); }
.template-2 { background: var(--mx-accent); }
.template-3 { aspect-ratio: 9 / 16; max-height: 280px; background: var(--mx-primary); color: #fff; }
.template-3 strong { color: var(--mx-accent); }
.offer-card { display: grid; grid-template-columns: 150px 1fr; }
.offer-grid > .empty-state { grid-column: 1 / -1; }
.offer-image { min-height: 190px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.offer-image img { width: 100%; height: 100%; object-fit: cover; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 1fr) 2fr 35px; align-items: center; gap: 9px; margin-bottom: 12px; }
.bar-row b { position: relative; height: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.bar-row b::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--value); border-radius: inherit; background: var(--mx-primary); }
.dark .bar-row b::after { background: var(--mx-accent); }

.login-body { position: relative; min-height: 100vh; display: grid; place-items: center; overflow-x: hidden; overflow-y: auto; padding: 24px; background: var(--bg); }
.login-body::before { content: ""; position: fixed; inset: 0 50% 0 0; z-index: -1; border-radius: 0 36px 36px 0; background: var(--mx-primary); }
.login-card, .install-card { width: min(100%, 430px); padding: 28px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: 0 24px 70px rgba(10, 25, 49, 0.18); }
.install-card { width: min(100%, 920px); }
.brand.center { justify-content: center; margin-bottom: 25px; color: var(--text); text-align: left; }
.brand.center .brand-copy strong { color: var(--text); }
.brand.center .brand-copy span { color: var(--muted); }
.auth-brand { width: min(100%, 280px); min-height: 82px; display: flex; align-items: center; justify-content: center; margin: 0 auto 22px; }
.auth-brand img { width: 100%; max-height: 96px; object-fit: contain; }
.auth-heading { margin-bottom: 20px; text-align: center; }
.auth-heading h1 { margin-bottom: 6px; font-size: 20px; }
.auth-heading p { margin: 0; font-size: 11px; }
.login-card form { display: grid; gap: 15px; }
.login-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 17px; }
.login-links button { padding: 0; border: 0; background: transparent; color: var(--text); font-weight: 700; }
.check { display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); }
.check span { font-weight: 800; }
.check span svg { width: 15px; height: 15px; }
.check.ok span { color: var(--success); }
.check.fail span { color: var(--danger); }
.install-checks { margin-bottom: 24px; }
.install-form h2 { margin: 12px 0 -3px; padding-bottom: 9px; border-bottom: 1px solid var(--border); }
.install-card > .system-banner { margin-top: 2px; }
.app-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 2px 4px; color: var(--soft); font-size: 9px; }
.app-footer span:last-child { display: inline-flex; align-items: center; gap: 6px; }
.app-footer i { width: 7px; height: 7px; border-radius: 50%; background: #10b981; }
.theme-construction .sidebar nav a.active::before,
.theme-construction .live-pill i { background: var(--mx-highlight); }
.theme-construction .sidebar nav a b.hot { background: var(--mx-highlight); color: #fff; }
.theme-construction .live-pill i { box-shadow: 0 0 0 3px color-mix(in srgb, var(--mx-highlight) 15%, transparent); }
.mobile-only { display: none; }

@media (max-width: 1280px) {
  .cards { grid-template-columns: repeat(3, minmax(145px, 1fr)); }
  .form-grid.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quote-row { grid-template-columns: repeat(4, minmax(110px, 1fr)); }
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .mobile-only { display: inline-grid; }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 45; border: 0; background: rgba(10, 25, 49, 0.26); backdrop-filter: blur(2px); }
  body.menu-open .sidebar-overlay { display: block; }
  .topbar { padding: 0 18px; }
  .content { padding: 22px 18px; }
}

@media (max-width: 760px) {
  .topbar { height: 64px; }
  .content { min-height: calc(100vh - 64px); padding: 16px 12px; }
  .global-search, .topbar-divider, .topbar-user > span:last-child, .live-pill, .breadcrumb em { display: none; }
  .title-line h1 { font-size: 18px; }
  .breadcrumb { margin-top: 2px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two, .template-grid, .offer-grid, .dashboard-side { grid-template-columns: 1fr; }
  .theme-options { grid-template-columns: 1fr; }
  .logo-setting { align-items: stretch; flex-direction: column; }
  .logo-preview { width: 100%; flex-basis: 102px; }
  .offer-card { grid-template-columns: 120px 1fr; }
  .system-banner { align-items: flex-start; flex-wrap: wrap; }
  .system-banner form { width: 100%; }
  .system-banner .button { width: 100%; }
  .panel { padding: 16px; border-radius: 17px; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .app-footer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 540px) {
  .sidebar { width: min(92vw, 320px); }
  .cards, .form-grid, .form-grid.wide { grid-template-columns: 1fr; }
  .metric { min-height: 128px; }
  .quick-actions .button { flex: 1 1 100%; }
  .toolbar > input, .toolbar > select, .toolbar > label, .toolbar .button { width: 100%; }
  .quote-row { grid-template-columns: 1fr 1fr; padding: 11px; }
  .quote-row input[name="item_name[]"] { grid-column: 1 / -1; }
  .quote-summary { align-items: flex-end; flex-direction: column; gap: 6px; }
  .offer-card { grid-template-columns: 1fr; }
  .offer-image { min-height: 220px; }
  .login-body { padding: 14px; }
  .login-body::before { inset: 0 0 56% 0; border-radius: 0 0 28px 28px; }
  .login-card, .install-card { padding: 22px; border-radius: 18px; }
  .login-links { align-items: flex-start; flex-direction: column; }
  dl { grid-template-columns: 1fr; gap: 3px; }
  dd { margin-bottom: 9px; }
}

@media print {
  .sidebar, .topbar, .button, .quick-actions, .app-footer { display: none !important; }
  .main { margin: 0; }
  .content { width: 100%; padding: 0; }
  body, .panel { background: #fff; color: #000; box-shadow: none; }
}
