:root {
  color-scheme: light;
  --brand-950: #0b1535;
  --brand-900: #111e4b;
  --brand-800: #15318d;
  --brand-700: #1630a6;
  --brand-600: #2549c7;
  --brand-200: #b9c8f2;
  --brand-100: #dce5ff;
  --brand-50: #f0f4ff;
  --canvas: #f4f6fb;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-subtle: #f8f9fd;
  --surface-hover: #f2f5ff;
  --text: #131c33;
  --text-soft: #48516a;
  --muted: #747b8d;
  --faint: #9298a8;
  --line: #e3e7f0;
  --line-strong: #cdd3e1;
  --amber: #99610b;
  --amber-bg: #fff6df;
  --red: #a22a2a;
  --red-bg: #fff0ef;
  --blue: #1630a6;
  --blue-bg: #eef5ff;
  --success: #16784f;
  --success-bg: #eaf7f1;
  --focus: #2f80ed;
  --shadow-sm: 0 1px 2px rgb(19 28 51 / 7%);
  --shadow-md: 0 12px 32px rgb(19 28 51 / 10%);
  --shadow-lg: 0 26px 80px rgb(11 21 53 / 18%);
  --sidebar-width: 252px;
  --sidebar-collapsed: 76px;
  --topbar-height: 64px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: 160ms ease;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0b1020;
  --surface: #12182a;
  --surface-raised: #171e33;
  --surface-subtle: #151c2f;
  --surface-hover: #1b2540;
  --text: #f4f6fb;
  --text-soft: #c8cede;
  --muted: #a1a9bd;
  --faint: #7f899f;
  --line: #29334d;
  --line-strong: #384563;
  --brand-200: #284889;
  --brand-100: #1a2f68;
  --brand-50: #142554;
  --amber-bg: #352914;
  --red-bg: #3a1d1d;
  --blue-bg: #1a2b40;
  --success: #62d6a5;
  --success-bg: #153329;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 20%);
  --shadow-md: 0 14px 36px rgb(0 0 0 / 28%);
  --shadow-lg: 0 28px 90px rgb(0 0 0 / 42%);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

html { background: var(--canvas); }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

button { color: inherit; }

button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 48%, transparent);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-md);
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.offline-banner {
  position: fixed;
  z-index: 800;
  inset: 0 0 auto;
  min-height: 40px;
  padding: 10px 20px;
  background: #fff3d8;
  border-bottom: 1px solid #e3bd67;
  color: #664309;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.offline-banner .status-dot { background: var(--amber); }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: #2563eb;
  box-shadow: 0 0 0 3px color-mix(in srgb, #2563eb 14%, transparent);
}

.button,
.icon-button,
.sidebar-collapse,
.user-menu-button,
.nav-link,
.text-button {
  appearance: none;
  border: 0;
  background: none;
  cursor: pointer;
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.button:hover:not(:disabled) { border-color: var(--brand-700); background: var(--surface-hover); }
.button:active:not(:disabled) { transform: translateY(1px); }
.button.primary { border-color: var(--brand-700); background: var(--brand-700); color: #fff; }
.button.primary:hover:not(:disabled) { border-color: var(--brand-800); background: var(--brand-800); }
.button.danger { border-color: color-mix(in srgb, var(--red) 55%, var(--line)); color: var(--red); }
.button.danger:hover:not(:disabled) { background: var(--red-bg); border-color: var(--red); }
.button.quiet { background: transparent; box-shadow: none; }
.button.small { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.button.full { width: 100%; }
.button:disabled, .icon-button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .52; }

.icon-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: background var(--transition), border-color var(--transition);
}

.icon-button:hover { background: var(--surface-hover); border-color: var(--line); }

[data-icon] { display: inline-grid; place-items: center; flex: 0 0 auto; }
[data-icon] svg { width: 18px; height: 18px; display: block; }

.auth-view {
  position: fixed;
  z-index: 500;
  inset: 0;
  overflow: auto;
  min-height: 100vh;
  background: var(--surface);
}

.auth-brand {
  position: absolute;
  z-index: 1;
  top: 32px;
  left: 40px;
  display: flex;
  align-items: center;
  gap: 15px;
  color: #fff;
}

.auth-brand img {
  width: 112px;
  height: 76px;
  padding: 8px 10px;
  border-radius: 14px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 12px 32px rgb(6 14 38 / 20%);
}
.auth-brand p { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.auth-brand span { display: block; max-width: 240px; margin-top: 2px; opacity: .8; font-size: 11px; }

.auth-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 1.06fr) minmax(460px, .94fr);
}

.auth-intro {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: center;
  padding: 150px clamp(48px, 7vw, 116px) 90px;
  background:
    linear-gradient(115deg, rgb(8 20 56 / 86%), rgb(22 48 166 / 60%)),
    url("/assets/emporio-login-hero.jpg") center / cover no-repeat;
  color: #fff;
  overflow: hidden;
  position: relative;
}

.auth-intro::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -210px;
  bottom: -190px;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 50%;
  box-shadow: 0 0 0 72px rgb(255 255 255 / 3%), 0 0 0 145px rgb(255 255 255 / 2%);
}

.auth-wordmark { margin: 0 0 22px; color: #cbd7ff; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.auth-intro h1 { max-width: 640px; margin: 0; font-size: clamp(42px, 5vw, 68px); line-height: 1.02; letter-spacing: -.045em; text-shadow: none; }
.auth-intro > p:not(.auth-wordmark) { max-width: 540px; margin: 25px 0 0; color: rgb(255 255 255 / 76%); font-size: 17px; line-height: 1.65; }
.auth-flow { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; margin-top: 52px; color: rgb(255 255 255 / 70%); font-size: 12px; font-weight: 700; }
.auth-flow span:nth-child(odd) { padding: 8px 11px; border: 1px solid rgb(255 255 255 / 22%); border-radius: 999px; color: #fff; }

.auth-card {
  width: min(430px, calc(100vw - 48px));
  align-self: center;
  justify-self: center;
  padding: 42px 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface-raised);
  box-shadow: 0 26px 70px rgb(19 28 51 / 13%);
}

.auth-card-heading { display: grid; justify-items: center; gap: 8px; margin-bottom: 30px; text-align: center; }
.auth-card-logo { width: 162px; height: 110px; margin-bottom: 6px; object-fit: contain; }
.auth-card-kicker { display: block; color: var(--brand-700); font-size: 10px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.auth-card-heading h2 { margin: 2px 0 0; font-size: 25px; letter-spacing: -.035em; }
.auth-card-heading p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }

.form-stack { display: grid; gap: 17px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > span:first-child, .field-label { color: var(--text-soft); font-size: 12px; font-weight: 750; }
.field.is-required > span:first-child::after { content: " *"; color: var(--red); }
.field small { color: var(--muted); font-size: 11px; }
.form-required-note { margin: -3px 0 0; color: var(--muted); font-size: 11px; }
.bank-selector { display: grid; gap: 8px; }
.bank-selector input[hidden] { display: none; }

input, select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--brand-700) 42%, var(--line-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-700); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-700) 15%, transparent); }
textarea { min-height: 96px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; min-height: 0; accent-color: var(--brand-700); }

.password-control { position: relative; display: block; }
.password-control input { padding-right: 48px; }
.password-toggle { position: absolute; inset: 1px 1px auto auto; }
.form-message { margin: 0; padding: 10px 12px; border-radius: var(--radius); font-size: 12px; }
.error-message { border: 1px solid color-mix(in srgb, var(--red) 30%, var(--line)); background: var(--red-bg); color: var(--red); }
.google-section { margin-top: 22px; }
.separator { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; color: var(--muted); font-size: 11px; }
.separator::before, .separator::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.google-button { min-height: 44px; display: grid; place-items: center; }
.security-note { margin: 23px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.6; }

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  z-index: 120;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
  transition: width var(--transition), transform var(--transition);
}

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 17px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-brand img { width: 56px; height: 38px; flex: 0 0 auto; object-fit: contain; }
.sidebar-brand strong { display: block; font-size: 14px; letter-spacing: -.01em; }
.sidebar-brand span { display: block; margin-top: 1px; color: var(--muted); font-size: 10px; }

.primary-navigation { flex: 1; padding: 18px 11px; overflow: auto; scrollbar-width: thin; }
.nav-group + .nav-group { margin-top: 22px; }
.nav-group-label { margin: 0 9px 7px; color: var(--faint); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.nav-link {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-soft);
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
}
.nav-link:hover { background: var(--surface-hover); color: var(--text); }
.nav-link.active { background: var(--brand-50); color: var(--brand-700); font-weight: 750; box-shadow: inset 3px 0 0 var(--brand-700); }
.nav-link .nav-icon { width: 21px; }
.nav-link .nav-count { margin-left: auto; min-width: 22px; padding: 1px 6px; border-radius: 99px; background: var(--surface-subtle); color: var(--muted); font-size: 10px; text-align: center; }
.sidebar-collapse { min-height: 54px; display: flex; align-items: center; gap: 11px; padding: 10px 21px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; white-space: nowrap; }
.sidebar-collapse:hover { background: var(--surface-hover); color: var(--text); }

.app-shell.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
.app-shell.sidebar-collapsed .sidebar-brand { padding-inline: 18px; }
.app-shell.sidebar-collapsed .sidebar-brand > div,
.app-shell.sidebar-collapsed .nav-group-label,
.app-shell.sidebar-collapsed .nav-link > span:not(.nav-icon),
.app-shell.sidebar-collapsed .nav-count,
.app-shell.sidebar-collapsed .sidebar-collapse > span:last-child { display: none; }
.app-shell.sidebar-collapsed .nav-link { justify-content: center; padding-inline: 8px; }
.app-shell.sidebar-collapsed .nav-link.active { box-shadow: none; }
.app-shell.sidebar-collapsed .sidebar-collapse { justify-content: center; padding-inline: 0; }
.app-shell.sidebar-collapsed .sidebar-collapse .nav-icon { transform: rotate(180deg); }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); transition: margin var(--transition); }
.app-shell.sidebar-collapsed .workspace { margin-left: var(--sidebar-collapsed); }

.topbar {
  position: sticky;
  z-index: 90;
  top: 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
}
.topbar-spacer { flex: 1; }
.menu-button { display: none; }
.connection-status { display: inline-flex; align-items: center; padding: 0 12px; color: var(--text-soft); font-size: 12px; }
.user-menu-wrap { position: relative; }
.user-menu-button { min-height: 46px; display: flex; align-items: center; gap: 9px; padding: 4px 7px; border-radius: var(--radius); text-align: left; }
.user-menu-button:hover { background: var(--surface-hover); }
.avatar { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid #b9c8f2; border-radius: 50%; background: var(--brand-100); color: var(--brand-800); font-size: 11px; font-weight: 800; }
.user-label { display: grid; max-width: 190px; }
.user-label strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-label small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.user-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-md);
}
.user-menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border: 0; border-radius: 7px; background: none; color: var(--text-soft); cursor: pointer; font-size: 12px; text-align: left; }
.user-menu button:hover { background: var(--surface-hover); color: var(--text); }

.main-content { min-height: calc(100vh - var(--topbar-height)); padding: 30px clamp(20px, 3vw, 42px) 54px; }
.content-boundary { width: 100%; max-width: 1640px; margin: 0 auto; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-title h1 { margin: 0; font-size: clamp(25px, 2.2vw, 32px); line-height: 1.15; letter-spacing: -.045em; }
.page-title p { max-width: 720px; margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.tariff-tool-actions { justify-content: flex-start; }

.workflow-status-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 14px;
}
.workflow-status-tab {
  appearance: none;
  min-width: 0;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-soft);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}
.workflow-status-tab:hover { border-color: var(--brand-600); color: var(--brand-800); transform: translateY(-1px); }
.workflow-status-tab:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand-600) 30%, transparent); outline-offset: 2px; }
.workflow-status-tab.active { border-color: var(--brand-700); background: var(--brand-700); color: #fff; }
.workflow-status-tab span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 750; }
.workflow-status-tab strong { flex: 0 0 auto; min-width: 29px; padding: 5px 8px; border-radius: 999px; background: var(--surface-subtle); color: var(--brand-800); font-size: 12px; text-align: center; }
.workflow-status-tab.active strong { background: rgb(255 255 255 / 17%); color: #fff; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.toolbar .search-field { min-width: 260px; flex: 1 1 330px; position: relative; }
.toolbar .search-field input { padding-left: 38px; }
.toolbar .search-field [data-icon] { position: absolute; z-index: 1; top: 11px; left: 11px; color: var(--muted); }
.toolbar select { width: auto; min-width: 150px; }
.toolbar-meta { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }

.surface {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.surface-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.surface-header h2, .surface-header h3 { margin: 0; font-size: 15px; letter-spacing: -.015em; }
.surface-header p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.surface-body { padding: 18px; }

.table-scroll { width: 100%; overflow: auto; border-radius: inherit; scrollbar-color: var(--line-strong) transparent; }
.data-table { width: 100%; min-width: 880px; border-collapse: collapse; }
.data-table th {
  height: 46px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-subtle);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .045em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.data-table td { height: 54px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--text-soft); font-size: 12px; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr[data-selectable="true"] { cursor: pointer; }
.data-table tbody tr[data-selectable="true"]:hover td { background: var(--surface-hover); }
.data-table tbody tr.selected td { background: var(--brand-50); }
.data-table tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--brand-700); }
.data-table .cell-primary { color: var(--text); font-weight: 720; }
.data-table .cell-secondary { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.data-table .cell-actions { width: 44px; padding-inline: 5px; }
.table-footer { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.pagination { display: flex; align-items: center; gap: 5px; }
.pagination button { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text-soft); cursor: pointer; }
.pagination button.active { border-color: var(--brand-700); color: var(--brand-700); font-weight: 800; }

.badge { display: inline-flex; align-items: center; gap: 5px; max-width: 180px; padding: 3px 7px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--text-soft); font-size: 10px; font-weight: 750; line-height: 1.3; white-space: nowrap; }
.badge.success { border-color: color-mix(in srgb, var(--success) 35%, var(--line)); background: var(--success-bg); color: var(--success); }
.badge.warning { border-color: #e9bf6b; background: var(--amber-bg); color: var(--amber); }
.badge.danger { border-color: #e5a8a8; background: var(--red-bg); color: var(--red); }
.badge.info { border-color: #a7c5ea; background: var(--blue-bg); color: var(--blue); }
.badge.muted { color: var(--muted); }

.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.metric { min-width: 0; padding: 18px 20px; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric-label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.metric-value { margin-top: 8px; overflow: hidden; color: var(--text); font-size: 26px; font-weight: 800; letter-spacing: -.04em; text-overflow: ellipsis; white-space: nowrap; }
.metric-note { margin-top: 3px; color: var(--faint); font-size: 10px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, .6fr); gap: 18px; }
.dashboard-grid .span-all { grid-column: 1 / -1; }
.rank-list, .activity-list, .stack-list { display: grid; }
.rank-row, .activity-row, .stack-row { display: grid; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rank-row:last-child, .activity-row:last-child, .stack-row:last-child { border-bottom: 0; }
.rank-row { grid-template-columns: minmax(120px, 1fr) 2fr auto; }
.rank-label strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.rank-label span { color: var(--muted); font-size: 10px; }
.tariff-item-row { width: 100%; grid-template-columns: minmax(0, 1fr) auto; text-align: left; }
.tariff-item-row .rank-label { min-width: 0; }
.tariff-item-price { color: var(--text); font-size: 12px; font-weight: 800; text-align: right; white-space: nowrap; }
.bar-track { height: 7px; border-radius: 99px; background: var(--surface-subtle); overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--brand-700); }
.rank-value { min-width: 70px; color: var(--text); font-size: 11px; font-weight: 750; text-align: right; }

/* Dashboard inspirado en la maqueta operativa aprobada. */
.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  padding: 20px 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 6px solid var(--brand-700);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(30 30 25 / 6%);
}
.dashboard-eyebrow { color: var(--brand-700); font-size: 10px; font-weight: 900; letter-spacing: .12em; }
.dashboard-hero h2 { margin: 3px 0 6px; font-size: 22px; letter-spacing: -.025em; }
.dashboard-hero p { max-width: 760px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.dashboard-flow { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; white-space: nowrap; }
.dashboard-flow-step { padding: 7px 10px; border-radius: 999px; background: var(--surface-subtle); color: var(--muted); font-size: 11px; font-weight: 900; }
.dashboard-flow-step.active { background: var(--brand-100); color: var(--brand-800); }
.dashboard-flow-arrow { color: var(--faint); font-weight: 900; }
.dashboard-notice, .dashboard-positive-empty { display: flex; align-items: center; gap: 9px; border-radius: 12px; font-size: 12px; line-height: 1.5; }
.dashboard-notice { margin-bottom: 16px; padding: 11px 13px; border: 1px solid #f0cf8b; background: var(--amber-bg); color: var(--amber); }
.dashboard-positive-empty { min-height: 160px; justify-content: center; padding: 20px; background: var(--success-bg); color: var(--success); font-weight: 750; text-align: center; }
.dashboard-section-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 2px 10px; }
.dashboard-section-label span { font-size: 13px; font-weight: 900; }
.dashboard-section-label small { color: var(--muted); font-size: 11px; }
.dashboard-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.dashboard-metric-card {
  position: relative;
  min-width: 0;
  min-height: 125px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(30 30 25 / 6%);
}
.dashboard-metric-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #d8d6ce; }
.dashboard-metric-card.good::before { background: var(--success); }
.dashboard-metric-card.warn::before { background: #d99200; }
.dashboard-metric-card.danger::before { background: var(--red); }
.dashboard-metric-card.info::before { background: var(--blue); }
.dashboard-metric-label { color: var(--muted); font-size: 12px; }
.dashboard-metric-value { margin-top: 8px; overflow-wrap: anywhere; color: var(--text); font-size: 28px; font-weight: 850; font-variant-numeric: tabular-nums; letter-spacing: -.04em; line-height: 1.05; }
.dashboard-metric-value.money { font-size: clamp(18px, 2vw, 24px); }
.dashboard-metric-value.restricted { color: var(--muted); font-size: 18px; letter-spacing: -.02em; }
.dashboard-metric-note { margin-top: 6px; color: var(--faint); font-size: 11px; }
.dashboard-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.dashboard-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 24px rgb(30 30 25 / 6%); }
.dashboard-card-header { padding: 17px 18px 10px; }
.dashboard-card-header h2 { margin: 0; font-size: 15px; letter-spacing: -.015em; }
.dashboard-card-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.dashboard-card-body { padding: 8px 18px 18px; }
.dashboard-empty { min-height: 190px; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: 12px; text-align: center; }
.dashboard-donut-layout { min-height: 238px; display: grid; grid-template-columns: minmax(150px, .8fr) minmax(190px, 1.2fr); align-items: center; gap: 28px; }
.dashboard-donut { width: min(178px, 100%); aspect-ratio: 1; display: grid; place-items: center; justify-self: center; border-radius: 50%; }
.dashboard-donut > div { width: 66%; aspect-ratio: 1; display: grid; place-content: center; border-radius: 50%; background: var(--surface); text-align: center; box-shadow: 0 0 0 1px var(--line); }
.dashboard-donut strong { font-size: 27px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.dashboard-donut span { color: var(--muted); font-size: 9px; }
.dashboard-legend { display: grid; gap: 10px; }
.dashboard-legend > div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--text-soft); font-size: 11px; }
.dashboard-legend > div:last-child { border-bottom: 0; }
.dashboard-legend b { color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.dashboard-legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.dashboard-legend-dot.good { background: var(--success); }
.dashboard-legend-dot.warn { background: var(--amber); }
.dashboard-bars { display: grid; }
.dashboard-bar-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(100px, 1.35fr) auto; align-items: center; gap: 11px; min-height: 42px; border-bottom: 1px solid var(--line); }
.dashboard-bar-row:last-child { border-bottom: 0; }
.dashboard-bar-copy { min-width: 0; }
.dashboard-bar-copy strong { display: block; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-bar-copy span { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.dashboard-bar-track { height: 7px; overflow: hidden; border-radius: 999px; background: var(--surface-subtle); }
.dashboard-bar-fill { height: 100%; border-radius: inherit; background: var(--brand-700); }
.dashboard-bar-fill.warn { background: var(--amber); }
.dashboard-bar-fill.danger { background: var(--red); }
.dashboard-bar-value { min-width: 35px; color: var(--text); font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; }
.dashboard-month-chart { height: 252px; display: flex; align-items: stretch; gap: clamp(5px, 1vw, 12px); padding-top: 20px; }
.dashboard-month-column { min-width: 0; display: grid; grid-template-rows: 18px minmax(150px, 1fr) 16px 13px; flex: 1; text-align: center; }
.dashboard-month-value { color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.dashboard-month-track { display: flex; align-items: flex-end; justify-content: center; min-height: 150px; border-bottom: 1px solid var(--line); }
.dashboard-month-fill { width: min(28px, 72%); min-height: 0; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg, #5f7de0, var(--brand-700)); }
.dashboard-month-column strong { margin-top: 4px; overflow: hidden; color: var(--text-soft); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.dashboard-month-column small { color: var(--faint); font-size: 8px; }
.dashboard-attention-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr); gap: 18px; }
.dashboard-priority-list { display: grid; }
.dashboard-priority-row { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); text-align: left; }
.dashboard-priority-row:last-child { border-bottom: 0; }
.dashboard-priority-marker { width: 5px; height: 42px; border-radius: 999px; background: var(--amber); }
.dashboard-priority-marker.urgente { background: var(--red); }
.dashboard-priority-marker.normal { background: var(--brand-700); }
.dashboard-priority-copy { min-width: 0; }
.dashboard-priority-copy strong { display: block; font-size: 12px; }
.dashboard-priority-copy span { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-priority-meta { display: grid; justify-items: end; gap: 4px; color: var(--muted); font-size: 9px; }
.dashboard-progress-summary { margin-bottom: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-subtle); }
.dashboard-progress-summary > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dashboard-progress-summary span { color: var(--text-soft); font-size: 11px; font-weight: 750; }
.dashboard-progress-summary strong { color: var(--brand-700); font-size: 20px; font-variant-numeric: tabular-nums; }
.dashboard-progress-summary p { margin: 7px 0 0; color: var(--muted); font-size: 10px; }
.dashboard-progress-track { height: 9px; margin-top: 9px; overflow: hidden; border-radius: 999px; background: var(--line); }
.dashboard-progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-700), #5f7de0); }
.dashboard-progress-summary.secondary .dashboard-progress-fill { background: linear-gradient(90deg, var(--blue), #6196dc); }
.dashboard-progress-summary.secondary strong { color: var(--blue); }

.empty-state, .loading-state, .unavailable-state {
  min-height: 260px;
  display: grid;
  place-items: center;
  padding: 44px 22px;
  text-align: center;
}
.state-content { max-width: 430px; }
.state-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 13px; border-radius: 50%; background: var(--surface-subtle); color: var(--muted); }
.state-icon svg { width: 23px; height: 23px; }
.state-content h2, .state-content h3 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.state-content p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.state-content .button { margin-top: 16px; }
.spinner { width: 26px; height: 26px; margin: 0 auto 14px; border: 2px solid var(--line); border-top-color: var(--brand-700); border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.detail-panel {
  position: fixed;
  z-index: 160;
  inset: 0 0 0 auto;
  width: min(410px, 92vw);
  overflow: auto;
  border-left: 1px solid var(--line);
  background: var(--surface-raised);
  box-shadow: -16px 0 50px rgb(11 21 53 / 11%);
  transform: translateX(102%);
  transition: transform 220ms ease;
}
.detail-panel.open { transform: translateX(0); }
.detail-header { position: sticky; z-index: 3; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 20px 15px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface-raised) 94%, transparent); backdrop-filter: blur(12px); }
.detail-header h2 { margin: 0; font-size: 19px; letter-spacing: -.03em; }
.detail-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.detail-body { padding: 20px; }
.detail-section + .detail-section { margin-top: 23px; padding-top: 20px; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 13px; font-size: 13px; }
.definition-list { display: grid; grid-template-columns: minmax(100px, 40%) 1fr; gap: 10px 14px; margin: 0; }
.definition-list dt { color: var(--muted); font-size: 11px; }
.definition-list dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--text); font-size: 11px; font-weight: 650; }
.detail-actions { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 22px -20px -20px; padding: 14px 20px 20px; border-top: 1px solid var(--line); background: var(--surface-raised); }
.detail-actions .primary { grid-column: 1 / -1; }

.timeline { display: grid; }
.timeline-row { position: relative; display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; min-height: 58px; }
.timeline-row::before { content: ""; position: absolute; top: 28px; bottom: -6px; left: 13px; width: 1px; background: var(--line-strong); }
.timeline-row:last-child::before { display: none; }
.timeline-marker { position: relative; z-index: 1; width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: var(--muted); font-size: 10px; font-weight: 800; }
.timeline-row.complete .timeline-marker { border-color: var(--brand-700); background: var(--brand-700); color: #fff; }
.timeline-row.current .timeline-marker { border: 2px solid var(--amber); color: var(--amber); }
.timeline-copy strong { display: block; margin-top: 3px; font-size: 11px; }
.timeline-copy span { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.timeline-action { padding-top: 1px; }

.people-list { display: flex; gap: 13px; flex-wrap: wrap; }
.person-chip { display: grid; justify-items: center; gap: 4px; max-width: 62px; color: var(--muted); font-size: 9px; text-align: center; }
.person-chip .avatar { width: 30px; height: 30px; }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; padding-bottom: 1px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { appearance: none; min-height: 40px; padding: 9px 12px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { border-bottom-color: var(--brand-700); color: var(--brand-700); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-all { grid-column: 1 / -1; }
.check-field { display: flex; align-items: flex-start; gap: 9px; padding-top: 5px; color: var(--text-soft); font-size: 12px; }
.check-field input { margin-top: 1px; flex: 0 0 auto; }
.inline-form { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.inline-form .field { min-width: 180px; flex: 1; }
.field-error { color: var(--red); font-size: 10px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.service-combobox { position: relative; min-width: 0; }
.service-combobox-input-wrap { position: relative; }
.service-combobox-input { padding-right: 38px; text-overflow: ellipsis; }
.service-combobox.has-selection .service-combobox-input { padding-right: 70px; }
.service-combobox-clear {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 34px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transform: translateY(-50%);
}
.service-combobox-clear:hover, .service-combobox-clear:focus-visible { background: var(--surface-hover); color: var(--text); outline: none; }
.service-combobox-clear[hidden] { display: none; }
.service-combobox-toggle {
  position: absolute;
  top: 50%;
  right: 15px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  pointer-events: none;
  transform: translateY(-68%) rotate(45deg);
  transition: transform var(--transition), border-color var(--transition);
}
.service-combobox.open .service-combobox-toggle {
  border-color: var(--brand-700);
  transform: translateY(-30%) rotate(225deg);
}
.service-combobox.has-selection .service-combobox-input {
  border-color: color-mix(in srgb, var(--brand-700) 55%, var(--line-strong));
  background: color-mix(in srgb, var(--brand-50) 58%, var(--surface));
  font-weight: 650;
}
.service-combobox-selection {
  display: block;
  width: max-content;
  max-width: 100%;
  margin-top: 6px;
  padding: 3px 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--brand-50);
  color: var(--brand-800);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.service-combobox-list {
  position: absolute;
  z-index: 80;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  max-height: 286px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--brand-700) 28%, var(--line-strong));
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--brand-700) 35%, transparent) transparent;
}
.service-combobox-list[hidden] { display: none; }
.service-combobox-option {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px 11px;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
}
.service-combobox-option + .service-combobox-option { border-top: 1px solid var(--line); }
.service-combobox-option:hover,
.service-combobox-option[aria-selected="true"] {
  background: var(--brand-50);
  color: var(--brand-900);
}
.service-combobox-option-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.service-combobox-code {
  color: var(--brand-700);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .015em;
  white-space: nowrap;
}
.service-combobox-name,
.service-combobox-category {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.service-combobox-name { color: var(--text); font-size: 11px; font-weight: 700; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; }
.service-combobox-category {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.service-combobox-empty { padding: 18px 12px; color: var(--muted); font-size: 11px; text-align: center; }
.service-combobox[aria-disabled="true"] .service-combobox-selection { opacity: .62; }

.tariff-preview { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--brand-100); border-radius: var(--radius-lg); background: linear-gradient(145deg, var(--brand-50), var(--surface)); }
.tariff-preview-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.tariff-preview-header > div { min-width: 0; display: grid; gap: 3px; }
.tariff-preview-header strong { color: var(--brand-800); font-size: 12px; }
.tariff-preview-header span:not(.badge) { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.tariff-preview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tariff-preview-value { min-width: 0; display: grid; align-content: start; gap: 3px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-raised); }
.tariff-preview-value > span { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.tariff-preview-value strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.tariff-preview-value small { color: var(--brand-700); font-size: 9px; font-weight: 750; }
.field.tariff-readonly input { border-color: var(--brand-100); background: var(--brand-50); color: var(--brand-800); font-weight: 700; }

.app-dialog {
  width: min(720px, calc(100vw - 28px));
  max-height: min(860px, calc(100vh - 28px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.app-dialog::backdrop { background: rgb(7 13 35 / 48%); backdrop-filter: blur(2px); }
.app-dialog form { max-height: inherit; display: flex; flex-direction: column; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.dialog-eyebrow { margin: 0 0 3px; color: var(--brand-700); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.dialog-body { padding: 22px; overflow: auto; }
.dialog-error { margin: 0 22px 14px; }
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 22px 18px; border-top: 1px solid var(--line); background: var(--surface-subtle); }

.toast-region { position: fixed; z-index: 1000; right: 18px; bottom: 18px; width: min(380px, calc(100vw - 36px)); display: grid; gap: 8px; pointer-events: none; }
.toast { display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 10px; padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-raised); box-shadow: var(--shadow-md); pointer-events: auto; animation: toast-in 190ms ease-out; }
.toast-icon { color: var(--brand-700); }
.toast.error .toast-icon { color: var(--red); }
.toast.warning .toast-icon { color: var(--amber); }
.toast strong { display: block; font-size: 12px; }
.toast p { margin: 2px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.toast button { width: 26px; height: 26px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.note-list { display: grid; gap: 9px; }
.note { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-subtle); }
.note.important { border-left: 3px solid var(--amber); }
.note p { margin: 0; color: var(--text-soft); font-size: 11px; white-space: pre-wrap; }
.note footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; color: var(--muted); font-size: 9px; }
.note-actions { display: flex; align-items: center; gap: 3px; }
.note-actions .icon-button { width: 25px; height: 25px; }
.note-history { margin-top: 12px; }
.note-history summary { color: var(--brand-700); cursor: pointer; font-size: 10px; font-weight: 750; }
.note-history .note-list { margin-top: 9px; }
.note-history .note { opacity: .82; }

.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); min-width: 840px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.calendar-heading, .calendar-day { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.calendar-heading { padding: 8px; background: var(--surface-subtle); color: var(--muted); font-size: 10px; font-weight: 800; text-align: center; text-transform: uppercase; }
.calendar-day { min-height: 120px; padding: 9px; background: var(--surface); }
.calendar-day.outside { background: var(--surface-subtle); color: var(--faint); }
.calendar-day.today { box-shadow: inset 0 0 0 2px var(--brand-700); }
.day-number { min-width: 25px; height: 25px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; font-size: 11px; font-weight: 800; }
.day-number:hover, .day-number:focus-visible { background: var(--brand-100); color: var(--brand-800); outline: none; }
.calendar-event { width: 100%; display: block; margin-top: 5px; padding: 5px 6px; overflow: hidden; border: 0; border-left: 3px solid var(--brand-700); border-radius: 4px; background: var(--brand-50); color: var(--brand-800); cursor: pointer; font-size: 9px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event.overdue { border-left-color: var(--red); background: var(--red-bg); color: var(--red); }
.calendar-event.completed { opacity: .65; text-decoration: line-through; }
.calendar-more { margin-top: 5px; padding: 2px 0; border: 0; background: transparent; color: var(--brand-700); cursor: pointer; font-size: 9px; font-weight: 750; }
.calendar-help { margin: 10px 2px 0; color: var(--muted); font-size: 10px; }
.calendar-day-list { display: grid; gap: 7px; }
.calendar-day-list-item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); cursor: pointer; text-align: left; }
.calendar-day-list-item:hover { border-color: var(--brand-200); background: var(--brand-50); }
.calendar-day-list-item > div { min-width: 0; display: grid; gap: 3px; }
.calendar-day-list-item strong, .calendar-day-list-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-day-list-item strong { font-size: 11px; }
.calendar-day-list-item span { color: var(--muted); font-size: 9px; }

.import-dropzone { display: grid; place-items: center; min-height: 250px; padding: 34px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--surface-subtle); text-align: center; }
.import-dropzone.dragover { border-color: var(--brand-700); background: var(--brand-50); }
.import-dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.import-dropzone h2 { margin: 12px 0 0; font-size: 17px; }
.import-dropzone p { max-width: 430px; margin: 7px 0 16px; color: var(--muted); font-size: 12px; }
.file-list { display: grid; gap: 7px; margin-top: 12px; }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 11px; }

.system-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; }
.system-nav { position: sticky; top: calc(var(--topbar-height) + 20px); align-self: start; display: grid; gap: 3px; padding: 7px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.system-nav button { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 0; border-radius: 7px; background: none; color: var(--muted); cursor: pointer; font-size: 11px; text-align: left; }
.system-nav button:hover { background: var(--surface-hover); color: var(--text); }
.system-nav button.active { background: var(--brand-50); color: var(--brand-700); font-weight: 750; }
.json-value { max-width: 540px; overflow: hidden; color: var(--text-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.callout { display: flex; align-items: flex-start; gap: 10px; padding: 12px 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-subtle); color: var(--text-soft); font-size: 11px; line-height: 1.55; }
.callout.info { border-color: #b9d2ed; background: var(--blue-bg); color: var(--blue); }
.callout.success { border-color: color-mix(in srgb, var(--success) 35%, var(--line)); background: var(--success-bg); color: var(--success); }
.callout.warning { border-color: #eac77e; background: var(--amber-bg); color: var(--amber); }
.callout.danger { border-color: #e9b0b0; background: var(--red-bg); color: var(--red); }
.code { padding: 2px 5px; border-radius: 4px; background: var(--surface-subtle); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }

h1, h2, h3 { animation: none; }
.toolbar-wrap { flex-wrap: wrap; }
.filter-surface { display: grid; gap: 14px; margin-bottom: 18px; padding: 14px; }
.compact-filter { display: grid; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 750; }
.compact-filter input { min-width: 142px; }
.filter-clear-action { display: flex; align-items: end; }
.filter-clear-action .button { width: 100%; min-height: 40px; justify-content: center; }
.statistics-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  align-items: end;
  gap: 12px;
}
.statistics-filter-grid .field > span:first-child, .statistics-filter-grid .compact-filter > span:first-child { font-size: 10px; }
.statistics-service-filter .service-combobox-list { min-width: min(520px, calc(100vw - 72px)); }
.year-compare-controls { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.year-compare-controls .field { min-width: 140px; }
.comparison-hint { align-self: center; color: var(--amber); font-size: 11px; font-weight: 700; }
.state-actions { display: flex; justify-content: center; gap: 9px; flex-wrap: wrap; margin-top: 16px; }
.state-actions .button { margin-top: 0; }
.control-filter-surface { gap: 16px; }
.control-filter-grid {
  display: grid;
  grid-template-columns: minmax(250px, 1.35fr) minmax(280px, 1.5fr) repeat(3, minmax(145px, .72fr));
  align-items: end;
  gap: 12px;
}
.control-filter-grid .field > span:first-child, .control-filter-grid .compact-filter > span:first-child { font-size: 10px; }
.control-filter-search .search-field { position: relative; display: block; }
.control-filter-search .search-field input { padding-left: 38px; }
.control-filter-search .search-field [data-icon] { position: absolute; z-index: 1; top: 11px; left: 11px; color: var(--muted); }
.control-service-filter .service-combobox-list { min-width: min(620px, calc(100vw - 72px)); }
.control-date-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(145px, 1fr)) minmax(140px, auto) minmax(110px, auto);
  align-items: end;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.control-result-meta { align-self: center; justify-self: end; color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
.control-form-section { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.form-required-note + .control-form-section { margin-top: 0; padding-top: 5px; border-top: 0; }
.control-form-section h3 { margin: 0; color: var(--brand-800); font-size: 13px; }
.control-form-section p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.control-form-grid { column-gap: 18px; row-gap: 15px; }
select[multiple] { min-height: 112px; padding: 6px; }
.payment-summary { border-left: 4px solid var(--brand-700); }
.global-reminder-label { display: inline-flex; padding: 3px 8px; border-radius: 999px; background: var(--brand-100); color: var(--brand-800); font-size: 11px; font-weight: 800; }
.record-timeline { position: relative; display: grid; gap: 0; margin-top: 8px; }
.record-timeline::before { position: absolute; top: 10px; bottom: 10px; left: 6px; width: 2px; background: var(--line-strong); content: ""; }
.record-timeline-event { position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 10px; padding: 8px 0; }
.record-timeline-marker { z-index: 1; width: 14px; height: 14px; margin-top: 3px; border: 3px solid var(--surface); border-radius: 50%; background: var(--brand-700); box-shadow: 0 0 0 1px var(--brand-700); }
.record-timeline-event strong { display: block; color: var(--text); font-size: 12px; }
.record-timeline-event p { margin: 3px 0; color: var(--text-soft); font-size: 11px; }
.record-timeline-event small { display: block; color: var(--muted); font-size: 10px; }

body.detail-open .workspace { padding-right: min(410px, 92vw); }

@media (max-width: 1240px) {
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .metric:nth-child(4) { border-top: 1px solid var(--line); }
  .dashboard-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-hero { align-items: flex-start; flex-direction: column; }
  .dashboard-flow { flex-wrap: wrap; white-space: normal; }
  body.detail-open .workspace { padding-right: 0; }
  .detail-panel { width: min(440px, 96vw); }
  .control-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control-filter-search, .control-service-filter { grid-column: span 1; }
  .control-date-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .statistics-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .auth-layout { grid-template-columns: 1fr; background: var(--canvas); }
  .auth-intro { min-height: 420px; padding-top: 130px; padding-bottom: 64px; }
  .auth-intro h1 { font-size: clamp(38px, 7vw, 58px); }
  .auth-card { margin: 44px auto; }
  .sidebar { transform: translateX(-102%); box-shadow: var(--shadow-lg); }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .app-shell.sidebar-collapsed .sidebar { width: var(--sidebar-width); }
  .app-shell.sidebar-collapsed .sidebar-brand > div,
  .app-shell.sidebar-collapsed .nav-group-label,
  .app-shell.sidebar-collapsed .nav-link > span:not(.nav-icon),
  .app-shell.sidebar-collapsed .nav-count,
  .app-shell.sidebar-collapsed .sidebar-collapse > span:last-child { display: initial; }
  .app-shell.sidebar-collapsed .nav-link { justify-content: flex-start; padding-inline: 10px; }
  .workspace, .app-shell.sidebar-collapsed .workspace { margin-left: 0; }
  .menu-button { display: inline-grid; }
  .sidebar-scrim { position: fixed; z-index: 110; inset: 0; background: rgb(7 13 35 / 42%); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-attention-grid { grid-template-columns: 1fr; }
  .system-layout { grid-template-columns: 1fr; }
  .system-nav { position: static; grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
}

@media (max-width: 700px) {
  .offline-banner { text-align: left; }
  .auth-brand { top: 23px; left: 24px; }
  .auth-brand img { width: 94px; height: 64px; padding: 7px 8px; }
  .auth-brand div { display: none; }
  .auth-layout { display: block; min-height: 100vh; }
  .auth-intro { min-height: 310px; padding: 105px 25px 40px; }
  .auth-intro h1 { font-size: 34px; line-height: 1.05; }
  .auth-intro > p:not(.auth-wordmark) { margin-top: 18px; font-size: 13px; }
  .auth-flow { margin-top: 24px; gap: 7px; }
  .auth-card { width: calc(100% - 24px); margin: -14px auto 18px; padding: 24px 22px; position: relative; z-index: 2; }
  .auth-card-heading { gap: 6px; margin-bottom: 22px; }
  .auth-card-logo { width: 130px; height: 88px; margin-bottom: 0; }
  .security-note { margin-top: 18px; padding-top: 14px; }
  .topbar { padding-inline: 12px; }
  .connection-status { padding: 0; }
  .connection-status span:last-child, .user-label, #theme-button { display: none; }
  .main-content { padding: 22px 14px 42px; }
  .page-header { display: grid; gap: 16px; }
  .page-actions { justify-content: flex-start; }
  .workflow-status-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-status-tab { min-height: 56px; padding: 11px 12px; }
  .dashboard-section-label { align-items: flex-start; flex-direction: column; }
  .dashboard-chart-grid { grid-template-columns: 1fr; }
  .dashboard-donut-layout { grid-template-columns: 1fr; gap: 18px; padding-top: 14px; }
  .dashboard-bar-row { grid-template-columns: minmax(100px, 1fr) auto; padding: 8px 0; }
  .dashboard-bar-track { grid-column: 1 / -1; }
  .dashboard-month-chart { gap: 4px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar .search-field { min-width: 0; flex-basis: auto; }
  .toolbar select { width: 100%; }
  .compact-filter input { width: 100%; min-width: 0; }
  .control-filter-grid, .control-date-grid, .statistics-filter-grid { grid-template-columns: 1fr; }
  .control-result-meta { justify-self: start; }
  .control-service-filter .service-combobox-list, .statistics-service-filter .service-combobox-list { min-width: 100%; }
  .year-compare-controls { align-items: stretch; flex-direction: column; }
  .toolbar-meta { margin-left: 0; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .metric { padding: 15px; }
  .metric-value { font-size: 22px; }
  .table-footer { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-all { grid-column: auto; }
  .tariff-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tariff-preview-header { align-items: stretch; flex-direction: column; }
  .detail-panel { inset: 0; width: 100%; }
  .detail-header { padding-top: 16px; }
  .dialog-body { padding: 18px; }
  .dialog-actions { padding-inline: 18px; flex-wrap: wrap; }
  .dialog-actions .button { flex: 1; }
  .rank-row { grid-template-columns: 1fr auto; }
  .rank-row .bar-track { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
  .tariff-preview-grid { grid-template-columns: 1fr; }
  .metric-strip { grid-template-columns: 1fr; }
  .metric + .metric, .metric:nth-child(3), .metric:nth-child(4) { border-top: 1px solid var(--line); border-left: 0; }
  .dashboard-metrics { grid-template-columns: 1fr; }
  .dashboard-hero { padding: 18px; }
  .dashboard-flow { gap: 5px; }
  .dashboard-flow-step { padding: 6px 8px; font-size: 10px; }
  .dashboard-flow-arrow { display: none; }
  .dashboard-priority-row { grid-template-columns: auto minmax(0, 1fr); }
  .dashboard-priority-meta { grid-column: 2; justify-items: start; }
  .detail-actions { grid-template-columns: 1fr; }
  .detail-actions .primary { grid-column: auto; }
  .service-combobox-option-main { grid-template-columns: 1fr; gap: 3px; }
}

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

@media print {
  .sidebar, .topbar, .page-actions, .toolbar, .detail-panel, .toast-region, .offline-banner { display: none !important; }
  .workspace, .app-shell.sidebar-collapsed .workspace { margin: 0; }
  .main-content { padding: 0; }
  .surface, .dashboard-hero, .dashboard-metric-card, .dashboard-card { box-shadow: none; break-inside: avoid; }
  .dashboard-chart-grid, .dashboard-attention-grid { display: block; }
  .dashboard-card { margin-bottom: 14px; }
}
