:root {
  --bg: #06101a;
  --bg-soft: #091520;
  --panel: #0c1e2b;
  --surface: #0b1822;
  --surface-2: #091420;
  --stroke-dark: rgba(255, 255, 255, 0.08);
  --stroke-light: rgba(255, 255, 255, 0.09);
  --text: #dde9e3;
  --text-soft: rgba(210, 232, 222, 0.62);
  --ink: #dde9e3;
  --ink-soft: rgba(200, 225, 215, 0.58);
  --accent: #1e9b66;
  --accent-2: #0f6f7d;
  --danger: #e05252;
  --warning: #d4953a;
  --success: #1da870;
  --radius-lg: 22px;
  --radius-md: 17px;
  --radius-sm: 13px;
  --shadow: 0 20px 50px rgba(2, 8, 15, 0.38);
  --font-ui: "Manrope", "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Manrope", sans-serif;
  --font-mono: "Consolas", "Cascadia Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(30, 155, 102, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(15, 111, 125, 0.14), transparent 30%),
    linear-gradient(180deg, #050e17 0%, #07141e 100%);
}

body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; opacity: 0.06;
  background-image:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 32px 32px;
}

img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; min-width: 0; }
button { border: 0; }
textarea { resize: vertical; }

.hidden { display: none !important; }
.screen { min-height: 100vh; min-height: 100dvh; position: relative; }

/* ===== LOADER ===== */
.global-loader {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center; gap: 0.8rem;
  background: rgba(2, 7, 13, 0.9);
  backdrop-filter: blur(16px);
}
.global-loader img { width: 86px; height: 86px; object-fit: contain; }
.global-loader span {
  color: var(--text-soft); font-size: 0.76rem;
  letter-spacing: 0.18em; text-transform: uppercase;
  font-family: var(--font-mono);
}

/* ===== LOGIN ===== */
.login-screen, .app-shell { padding: clamp(0.75rem, 1.5vw, 1rem); }

.login-screen {
  display: grid;
  align-items: center;
  background:
    radial-gradient(860px 500px at 12% 0%, rgba(30, 155, 102, 0.17), transparent 60%),
    radial-gradient(860px 500px at 88% 10%, rgba(15, 111, 125, 0.15), transparent 60%),
    linear-gradient(180deg, #04060d 0%, #07101a 100%);
}

.login-screen::before, .login-screen::after {
  content: ""; position: absolute; border-radius: 999px;
  filter: blur(2px); opacity: 0.7;
}
.login-screen::before {
  width: 260px; height: 260px; top: -120px; right: -120px;
  background: radial-gradient(circle, rgba(30,155,102,0.24), transparent 70%);
  animation: loginFloat 10s ease-in-out infinite;
}
.login-screen::after {
  width: 240px; height: 240px; left: -120px; bottom: -120px;
  background: radial-gradient(circle, rgba(15,111,125,0.22), transparent 70%);
  animation: loginFloat 12s ease-in-out infinite reverse;
}

.login-shell, .workspace { width: min(1220px, 100%); margin: 0 auto; }

.login-shell {
  min-height: calc(100dvh - (clamp(0.75rem, 1.5vw, 1rem) * 2)); display: flex;
  align-items: center; justify-content: center;
  position: relative; z-index: 1;
}

.login-brand, .app-header, .app-brand, .app-user, .card-heading, .inline-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.login-brand, .app-brand { justify-content: flex-start; }

.login-stage {
  display: grid; gap: 0; align-items: stretch;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
}
.login-card {
  width: min(1040px, 100%); overflow: hidden;
  margin: 0 auto;
  border-radius: 24px; border: 1px solid rgba(148,163,184,0.18);
  background: rgba(12, 20, 38, 0.9);
  box-shadow: 0 28px 80px rgba(0,0,0,0.45);
  animation: loginReveal 0.6s ease both;
}
.login-aside, .login-form-panel { position: relative; overflow: hidden; }
.login-aside {
  padding: 2.8rem 2.6rem;
  background: linear-gradient(145deg, rgba(5, 9, 16, 0.98), rgba(12, 20, 38, 0.94));
}
.login-aside::before {
  content: ""; position: absolute; width: 260px; height: 260px;
  right: -120px; top: -120px;
  background: radial-gradient(circle, rgba(30,155,102,0.26), transparent 70%);
  opacity: 0.85;
}
.login-aside::after {
  content: ""; position: absolute; width: 240px; height: 240px;
  left: -120px; bottom: -120px;
  background: radial-gradient(circle, rgba(15,111,125,0.22), transparent 70%);
  opacity: 0.7;
}
.login-aside__inner {
  position: relative; z-index: 1; height: 100%;
  display: flex; flex-direction: column; gap: 1.8rem;
}
.login-brand img, .app-brand img { width: 54px; height: 54px; }
.login-screen .login-brand { align-items: center; gap: 0.9rem; }
.login-screen .login-brand img {
  width: 68px; height: 68px; padding: 0;
  border-radius: 0; background: transparent;
}
.login-brand__title {
  font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; font-size: 0.9rem; color: #f2f6f4;
}
.login-brand__subtitle {
  font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.28em; color: rgba(148,163,184,0.78);
}
.login-brand strong, .app-brand strong, .app-user strong { display: block; }
.login-brand span, .app-brand span, .app-user span, .muted-copy { color: var(--text-soft); }

.login-pill {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.4rem 0.9rem; border-radius: 999px;
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.2em;
  background: rgba(30,155,102,0.18); border: 1px solid rgba(30,155,102,0.38);
  color: #d7f5e6;
}
.login-pill svg, .field-icon svg, .login-highlight__icon svg {
  width: 16px; height: 16px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.login-hero h1, .login-form__header h2 {
  margin: 0; font-family: var(--font-display); letter-spacing: -0.04em;
}
.login-hero h1 {
  margin-top: 0.75rem; font-size: clamp(2rem, 4.8vw, 2.8rem);
  line-height: 1.05; color: #f5f8fb;
}
.login-hero p { margin: 0; max-width: 24rem; color: rgba(148,163,184,0.82); line-height: 1.55; }
.login-highlights { display: grid; gap: 0.6rem; }
.login-highlight {
  display: flex; align-items: center; gap: 0.7rem;
  color: rgba(226,232,240,0.92); font-size: 0.94rem;
}
.login-highlight__icon {
  width: 24px; height: 24px; display: inline-flex;
  align-items: center; justify-content: center;
  border-radius: 999px; flex: 0 0 24px; color: var(--accent);
}
.login-aside__footer {
  margin-top: auto; display: flex; align-items: center; gap: 0.5rem;
  color: rgba(148,163,184,0.78); font-size: 0.85rem;
}
.login-dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--accent); box-shadow: 0 0 12px rgba(30,155,102,0.6);
}
.login-form-panel {
  padding: 2.8rem 3rem;
  background: rgba(6, 10, 20, 0.9);
  display: grid;
  align-items: center;
}
.login-form__inner { width: min(420px, 100%); max-width: 420px; margin: 0 auto; }
.login-form__header { margin-bottom: 1.6rem; }
.login-eyebrow {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.25em;
  color: rgba(148,163,184,0.78); margin-bottom: 0.35rem;
  font-family: var(--font-mono);
}
.login-form__header h2 { font-size: 2.1rem; line-height: 1.05; color: #f3f7fb; }
.login-form__description, .login-form__hint { color: rgba(148,163,184,0.82); }
.login-form-panel .field span { color: rgba(185,210,200,0.78); }
.input-shell {
  position: relative; display: flex; align-items: center;
  border-radius: 14px; border: 1px solid rgba(148,163,184,0.22);
  background: rgba(2, 6, 18, 0.55);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.input-shell:focus-within {
  border-color: rgba(30,155,102,0.55);
  box-shadow: 0 0 0 4px rgba(30,155,102,0.16);
}
.field-icon {
  position: absolute; left: 1rem; color: rgba(185,210,200,0.7);
  display: inline-flex; align-items: center; justify-content: center;
}
.login-form-panel input,
.login-form-panel select,
.login-form-panel textarea { color: #ddeae4; }
.input-shell input {
  min-height: 52px; border: 0; background: transparent;
  box-shadow: none; padding-left: 3rem; color: inherit;
}
.input-shell input:focus { border-color: transparent; box-shadow: none; }
.password-shell input { padding-right: 4rem; }
.login-form-panel .ghost-icon { color: rgba(185,210,200,0.7); }
.login-form-panel .primary-button {
  min-height: 52px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 30px rgba(30,155,102,0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.login-form-panel .primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(30,155,102,0.28);
}
.login-form__footer {
  margin-top: 1.4rem; display: flex; justify-content: space-between;
  align-items: center; gap: 0.75rem; flex-wrap: wrap;
}
.login-form__footer .text-button { font-weight: 700; }
.login-form-panel .feedback { margin-top: 1rem; }

/* ===== CAPTCHA (login) ===== */
.captcha-box { padding: 0.9rem; }
.login-form-panel .captcha-box {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148,163,184,0.18);
  background: rgba(2, 8, 18, 0.4);
  color: rgba(185,210,200,0.85);
}
.login-form-panel .captcha-box .inline-head span { color: rgba(185,210,200,0.85); }
.login-form-panel .captcha-box input {
  background: rgba(4, 10, 24, 0.6);
  border-color: rgba(148,163,184,0.28);
  color: #ddeae4;
  padding-left: 0.95rem;
}
.captcha-image { width: 100%; max-width: 220px; border-radius: 12px; background: #fff; }

/* ===== DARK FORM INPUTS ===== */
input, select, textarea {
  width: 100%; min-height: 48px; border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.8rem 0.9rem;
  background: rgba(4, 12, 22, 0.7);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(30, 155, 102, 0.52);
  box-shadow: 0 0 0 3px rgba(30, 155, 102, 0.14);
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath fill='%23a8c4ba' d='M6 7L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 10px 7px;
  padding-right: 2.4rem;
  background-color: rgba(4, 12, 22, 0.7);
}
input[readonly], textarea[readonly] {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
  cursor: default;
}
::-webkit-calendar-picker-indicator { filter: invert(0.75) brightness(1.2); cursor: pointer; }
::-webkit-search-cancel-button { filter: invert(0.7) brightness(1.3); cursor: pointer; }

.password-field, .suffix-field { position: relative; display: flex; align-items: center; }
.password-field input { padding-right: 4rem; }
.suffix-field input { padding-right: 7rem; }
.suffix-field strong { position: absolute; right: 1rem; color: var(--ink-soft); font-weight: 700; }

/* ===== BUTTONS ===== */
.ghost-icon, .text-button, .primary-button, .secondary-button, .table-action { cursor: pointer; }
.ghost-icon {
  position: absolute; right: 0.4rem; min-width: 44px; min-height: 42px;
  border-radius: 11px; background: transparent; color: var(--text-soft);
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.15s ease, background 0.15s ease;
}
.ghost-icon:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.text-button {
  padding: 0; background: transparent;
  color: rgba(30, 200, 130, 0.9); font-weight: 600;
  transition: color 0.15s ease;
}
.text-button:hover { color: var(--accent); }
.primary-button, .secondary-button, .table-action {
  min-height: 46px; border-radius: 13px; padding: 0 1.1rem;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem; font-weight: 700; transition: all 0.2s ease;
}
.primary-button {
  color: #fff;
  background: linear-gradient(135deg, #1e9b66, #0f7080);
  box-shadow: 0 8px 22px rgba(30,155,102,0.22);
}
.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(30,155,102,0.3);
}
.primary-button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.secondary-button {
  color: var(--text); background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.secondary-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
}
.table-action {
  min-height: 36px; font-size: 0.82rem;
  color: rgba(150, 210, 190, 0.9);
  background: rgba(30, 155, 102, 0.1);
  border: 1px solid rgba(30, 155, 102, 0.2);
}
.table-action:hover { background: rgba(30, 155, 102, 0.18); }
.btn-spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; animation: spin 0.7s linear infinite;
}
.feedback { margin: 0; min-height: 1.1rem; color: var(--danger); font-size: 0.84rem; }
.feedback.success { color: var(--success); }
.feedback.info { color: rgba(100, 200, 230, 0.9); }
.feedback:empty { display: none; }

/* ===== CARDS / PANELS ===== */
.card, .hero-strip, .modal-card { border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card, .modal-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.065);
}
.modal-card { width: min(480px, calc(100vw - 2rem)); margin: 0 auto; padding: 1.5rem; }
.card, .hero-strip { padding: 1.25rem; }
.hero-strip {
  background: rgba(6, 18, 28, 0.8);
  border: 1px solid var(--stroke-dark);
}
.hero-strip h2, .card-heading h1, .card-heading h3, .card-heading h2 {
  margin: 0; letter-spacing: -0.03em;
}
.card-heading h1 { font-size: clamp(2rem, 6vw, 2.8rem); }
.card-heading p, .hero-strip p { margin: 0.35rem 0 0; }
.card-heading.compact { align-items: flex-start; }

.kicker, .field span, .profile-grid dt {
  margin: 0; font-family: var(--font-mono);
  font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
}
.kicker, .field span, .profile-grid dt { color: var(--ink-soft); }
.hero-strip .kicker, .hero-strip p { color: var(--text-soft); }
.hero-strip h2 { color: var(--text); }

/* ===== GRIDS ===== */
.form-stack, .field, .feed-list, .panel-screen { display: grid; gap: 0.85rem; }
.security-line, .view-tabs, .summary-grid, .inline-grid, .grid-two, .profile-grid {
  display: grid; gap: 0.75rem;
}
.workspace,
.panel-screen,
.grid-two,
.inline-grid,
.summary-grid,
.feed-list,
.table-host,
.table-shell,
.field,
.card,
.card > *,
.menu-hero,
.menu-hero__text,
.module-card,
.module-card__body,
.app-brand,
.app-user,
.card-heading,
.card-heading > div {
  min-width: 0;
}
.security-line { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.security-line span, .summary-card, .tag {
  padding: 0.65rem 0.85rem; border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft); font-size: 0.82rem;
}

/* ===== APP SHELL ===== */
.app-shell { display: grid; gap: 1rem; }
.app-header {
  width: min(1220px, 100%); margin: 0 auto;
  padding: 0.8rem 1rem; border-radius: var(--radius-lg);
  border: 1px solid var(--stroke-dark);
  background: rgba(6, 18, 28, 0.86);
}
.app-brand { gap: 0.75rem; }
.app-brand img {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
}
.app-brand strong {
  font-size: 1rem;
  line-height: 1.05;
}
.app-brand span {
  font-size: 0.82rem;
  line-height: 1.2;
}
.app-user {
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.app-user > div {
  min-width: 0;
  text-align: right;
  display: grid;
  gap: 0.14rem;
}
.app-user strong {
  font-size: 0.96rem;
  line-height: 1.08;
}
.app-user span {
  font-size: 0.8rem;
  line-height: 1.2;
}
.app-user .secondary-button {
  width: auto;
  min-width: 94px;
  min-height: 40px;
  padding: 0 1rem;
  flex: 0 0 auto;
}
.app-user strong,
.app-user span,
.app-brand strong,
.app-brand span,
.menu-hero__text h2,
.card-heading h1,
.card-heading h2,
.card-heading h3,
.feed-item strong,
.feed-item span,
.feed-item small {
  overflow-wrap: anywhere;
}

/* ===== TABS ===== */
.view-tabs {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  align-items: stretch;
}
.tab-button {
  min-height: 46px; border-radius: 13px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--text); font-weight: 600;
  letter-spacing: 0.01em; text-align: center;
  padding: 0.55rem 0.6rem; font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center; gap: 0.38rem;
  transition: all 0.2s ease; white-space: nowrap;
}
.tab-button i { font-size: 0.95rem; }
.tab-button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
}
.tab-button.active {
  background: linear-gradient(135deg, rgba(30,155,102,0.28), rgba(15,111,125,0.25));
  border-color: rgba(30, 155, 102, 0.42);
  color: rgba(200, 245, 225, 0.95);
  box-shadow: 0 10px 24px rgba(6, 18, 28, 0.28);
}

.top-feedback {
  padding: 0.85rem 1rem; border-radius: var(--radius-md);
  color: #cff0df; background: rgba(23, 138, 91, 0.2);
  border: 1px solid rgba(23, 138, 91, 0.3);
}
.top-feedback.error {
  color: #ffd9d9; background: rgba(220, 60, 60, 0.18);
  border-color: rgba(220, 60, 60, 0.3);
}

/* ===== SUMMARY CARDS ===== */
.summary-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.summary-grid.tight { margin-bottom: 0.85rem; }
.summary-card {
  background: rgba(6, 18, 28, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 15px; padding: 0.9rem 1rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.summary-card:hover {
  transform: translateY(-2px);
  border-color: rgba(30, 155, 102, 0.32);
}
.summary-card span {
  display: block; font-family: var(--font-mono);
  font-size: 0.67rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-soft);
}
.summary-card strong {
  display: block; margin-top: 0.3rem;
  color: var(--text); font-size: 1.45rem;
  font-family: var(--font-display); letter-spacing: -0.03em;
}

/* ===== MENU HERO ===== */
.menu-hero {
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(6, 18, 30, 0.92), rgba(8, 22, 38, 0.88));
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 1.8rem 2rem;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 2rem; flex-wrap: wrap;
}
.menu-hero__text { flex: 1; min-width: 220px; }
.menu-hero__text h2 {
  margin: 0.3rem 0 0; color: var(--text);
  font-family: var(--font-display); font-size: 1.8rem;
  letter-spacing: -0.03em;
}
.menu-hero__sub { margin: 0.5rem 0 0; color: var(--text-soft); line-height: 1.5; }
.menu-hero .summary-grid { flex: 1; min-width: 280px; }

/* ===== MODULE CARDS ===== */
.module-grid {
  display: grid; gap: 0.85rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.module-card {
  text-align: left; min-height: 96px;
  border-radius: 17px; border: 1px solid rgba(255, 255, 255, 0.055);
  background: rgba(6, 18, 28, 0.7);
  color: var(--text); padding: 1.15rem 1.35rem;
  display: flex; align-items: center; gap: 1rem;
  transition: all 0.25s ease; position: relative; overflow: hidden;
}
.module-card::before {
  content: ""; position: absolute; inset: 0;
  opacity: 0; transition: opacity 0.3s ease; border-radius: inherit;
}
.module-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(0,0,0,0.3);
  border-color: rgba(255, 255, 255, 0.11);
}
.module-card:hover::before { opacity: 1; }
.module-card__icon {
  width: 50px; height: 50px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 1.35rem; position: relative; z-index: 1;
}
.module-card__body { flex: 1; position: relative; z-index: 1; }
.module-card__body strong { font-size: 0.97rem; display: block; margin-bottom: 0.2rem; }
.module-card__body span { font-size: 0.8rem; color: var(--text-soft); line-height: 1.4; }
.module-card__arrow {
  font-size: 1.1rem; color: var(--text-soft);
  transition: transform 0.2s ease; position: relative; z-index: 1;
}
.module-card:hover .module-card__arrow { transform: translateX(4px); color: var(--text); }

.module-card--blue::before { background: linear-gradient(135deg, rgba(59,130,246,0.1), transparent); }
.module-card--blue .module-card__icon { background: rgba(59,130,246,0.15); color: #60a5fa; }
.module-card--green::before { background: linear-gradient(135deg, rgba(34,197,94,0.1), transparent); }
.module-card--green .module-card__icon { background: rgba(34,197,94,0.15); color: #4ade80; }
.module-card--purple::before { background: linear-gradient(135deg, rgba(168,85,247,0.1), transparent); }
.module-card--purple .module-card__icon { background: rgba(168,85,247,0.15); color: #c084fc; }
.module-card--amber::before { background: linear-gradient(135deg, rgba(245,158,11,0.1), transparent); }
.module-card--amber .module-card__icon { background: rgba(245,158,11,0.15); color: #fbbf24; }
.module-card--cyan::before { background: linear-gradient(135deg, rgba(6,182,212,0.1), transparent); }
.module-card--cyan .module-card__icon { background: rgba(6,182,212,0.15); color: #22d3ee; }
.module-card--teal::before { background: linear-gradient(135deg, rgba(20,184,166,0.1), transparent); }
.module-card--teal .module-card__icon { background: rgba(20,184,166,0.15); color: #2dd4bf; }
.module-card--red::before { background: linear-gradient(135deg, rgba(239,68,68,0.1), transparent); }
.module-card--red .module-card__icon { background: rgba(239,68,68,0.15); color: #f87171; }

.grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#budgets-panel.budget-home > .grid-two:first-of-type { grid-template-columns: minmax(0, 1fr); }
#budgets-panel.budget-home #budget-form-card,
#budgets-panel.budget-home #budget-detail-panels { display: none !important; }
.profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.inline-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

.profile-grid div, .feed-item, .empty-state, .table-shell, .captcha-box {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.03);
}
.profile-grid div, .feed-item, .empty-state { padding: 0.85rem; }
.profile-grid dd { margin: 0.3rem 0 0; color: var(--ink); font-weight: 600; }

.feed-item strong, .feed-item span, .feed-item small { display: block; }
.feed-item strong { color: var(--text); }
.feed-item span, .feed-item small, .empty-state { color: var(--text-soft); line-height: 1.5; }
.feed-item { overflow: hidden; }
.budget-item-card { position: relative; }
.budget-item-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: rgba(30, 155, 102, 0.55);
}
.budget-item-card-subitem {
  margin-left: 1rem;
  background: rgba(255, 255, 255, 0.045);
}
.budget-item-card-subitem::before { background: rgba(148, 163, 184, 0.42); }
.budget-warning-card {
  border-color: rgba(251, 146, 60, 0.35);
  background: rgba(251, 146, 60, 0.08);
}
.budget-history-card {
  border-color: rgba(59, 130, 246, 0.22);
  background: rgba(59, 130, 246, 0.06);
}
.budget-signature-card {
  border-color: rgba(30, 155, 102, 0.26);
  background: rgba(30, 155, 102, 0.07);
}
.budget-signature-image-wrap {
  margin-top: 0.45rem;
  padding: 0.55rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  text-align: center;
}
.budget-signature-image {
  max-width: 220px;
  max-height: 84px;
  border-radius: 8px;
  background: #ffffff;
  padding: 4px;
  border: 1px solid rgba(255,255,255,0.12);
}
.empty-state { color: var(--text-soft); text-align: center; padding: 1.2rem; }
.feed-item-selected {
  border-color: rgba(30, 155, 102, 0.4);
  box-shadow: 0 0 0 1px rgba(30, 155, 102, 0.18) inset;
  background: rgba(30, 155, 102, 0.06);
}

/* ===== TABLE ===== */
.table-host {
  width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.table-shell { min-width: 680px; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 0.78rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left; vertical-align: top;
}
th {
  color: var(--text-soft); font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.12em;
  background: rgba(255, 255, 255, 0.03);
}
td { color: var(--text); }
tr:last-child td { border-bottom: 0; }

/* ===== PILLS ===== */
.level-pill, .status-pill {
  display: inline-flex; align-items: center;
  min-height: 28px; padding: 0 0.65rem;
  border-radius: 999px; font-size: 0.74rem; font-weight: 700;
}
.level-pill.level-1 { background: rgba(168,85,247,0.16); color: #c084fc; }
.level-pill.level-2 { background: rgba(56,189,248,0.15); color: #7dd3fc; }
.level-pill.level-3 { background: rgba(251,191,36,0.15); color: #fde68a; }
.level-pill.level-4 { background: rgba(52,211,153,0.15); color: #6ee7b7; }
.status-pill.active { background: rgba(52,211,153,0.15); color: #6ee7b7; }
.status-pill.inactive { background: rgba(248,113,113,0.15); color: #fca5a5; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.18rem 0.55rem; border-radius: 999px;
  font-size: 0.71rem; font-weight: 700; letter-spacing: 0.02em;
}
.badge--planning { background: rgba(251,191,36,0.15); color: #fde68a; }
.badge--active { background: rgba(59,130,246,0.16); color: #93c5fd; }
.badge--done { background: rgba(52,211,153,0.15); color: #6ee7b7; }
.badge--cancelled { background: rgba(248,113,113,0.15); color: #fca5a5; }
.badge--low { background: rgba(52,211,153,0.13); color: #6ee7b7; }
.badge--normal { background: rgba(251,191,36,0.13); color: #fde68a; }
.badge--high { background: rgba(251,146,60,0.15); color: #fdba74; }
.badge--urgent { background: rgba(248,113,113,0.16); color: #fca5a5; }
.badge--stock-low { background: rgba(248,113,113,0.16); color: #fca5a5; }
.badge--stock-ok { background: rgba(52,211,153,0.13); color: #6ee7b7; }
.badge--maint-active {
  background: rgba(248,113,113,0.2); color: #f87171;
  animation: pulse-badge 2s ease-in-out infinite;
}
.badge--maint-done { background: rgba(148,163,184,0.12); color: rgba(148,163,184,0.8); }

/* ===== BUDGET STATUS PILLS ===== */
.budget-status-draft { background: rgba(148,163,184,0.12); color: rgba(148,163,184,0.85); border-radius: 999px; padding: 0.2rem 0.6rem; font-size: 0.72rem; font-weight: 700; }
.budget-status-submitted { background: rgba(59,130,246,0.15); color: #93c5fd; border-radius: 999px; padding: 0.2rem 0.6rem; font-size: 0.72rem; font-weight: 700; }
.budget-status-approved { background: rgba(52,211,153,0.15); color: #6ee7b7; border-radius: 999px; padding: 0.2rem 0.6rem; font-size: 0.72rem; font-weight: 700; }
.budget-status-rejected { background: rgba(248,113,113,0.15); color: #fca5a5; border-radius: 999px; padding: 0.2rem 0.6rem; font-size: 0.72rem; font-weight: 700; }

/* ===== MODAL ===== */
.modal {
  position: fixed; inset: 0; z-index: 120;
  overflow-y: auto;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 2rem 1rem;
}
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(1, 6, 13, 0.84);
  z-index: 0;
}
.modal-card {
  position: relative; z-index: 1;
  flex-shrink: 0; margin: auto;
}
.modal-close {
  position: relative;
  right: auto;
  min-width: 42px;
  min-height: 42px;
  flex: 0 0 auto;
}

.form-divider {
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 0.2rem 0;
  padding-top: 0.7rem;
}
.form-divider .kicker { margin-bottom: 0.5rem; }
.modal-note {
  margin: 0 0 0.5rem;
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* ===== SIGNATURE CANVAS ===== */
.signature-modal-card { width: min(560px, 100%); }
.signature-canvas-wrap {
  border: 2px solid rgba(30, 155, 102, 0.35);
  border-radius: 12px; overflow: hidden;
  background: #ffffff; cursor: crosshair;
  margin: 0.5rem 0;
}
.signature-canvas {
  display: block; width: 100%; height: 200px;
  touch-action: none;
}
.signature-controls {
  display: flex; gap: 0.6rem; flex-wrap: wrap;
  margin-top: 0.75rem;
}
.signature-controls .secondary-button { flex: 1; min-width: 90px; }
.signature-controls .primary-button { flex: 2; min-width: 140px; }
.signature-action-row {
  display: flex; gap: 0.6rem; flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.signature-action-row button { flex: 1; min-width: 140px; font-size: 0.84rem; }
.signature-preview {
  padding: 0.7rem; border-radius: 12px;
  border: 1px solid rgba(30, 155, 102, 0.3);
  background: rgba(30, 155, 102, 0.06);
  text-align: center; margin-bottom: 0.75rem;
}
.signature-preview p { margin: 0 0 0.4rem; }
.signature-preview img {
  max-height: 72px; border-radius: 8px;
  background: white; padding: 4px;
  border: 1px solid rgba(255,255,255,0.12);
  display: inline-block;
}

/* ===== KEYFRAMES ===== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes loginFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(20px); } }
@keyframes loginReveal { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse-badge { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .login-stage { grid-template-columns: 1fr; }
  .login-aside { border-bottom: 1px solid rgba(148,163,184,0.16); }
  .login-form-panel { padding: 2.2rem 2rem; }
  .grid-two, .profile-grid, .security-line { grid-template-columns: 1fr; }
  .app-header {
    flex-direction: row; flex-wrap: wrap;
    align-items: flex-start; gap: 0.75rem;
  }
  .app-user {
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }
  .app-user > div { text-align: left; }
  .card-heading, .inline-head { flex-wrap: wrap; }
  .module-grid { grid-template-columns: 1fr; }
  .menu-hero { flex-direction: column; }
  .menu-hero .summary-grid { width: 100%; min-width: 0; }
}

@media (max-width: 760px) {
  .login-shell {
    min-height: calc(100dvh - (clamp(0.75rem, 1.5vw, 1rem) * 2));
    align-items: stretch;
  }
  .app-header {
    padding: 0.85rem 0.9rem;
    gap: 0.9rem;
  }
  .app-brand img { width: 42px; height: 42px; }
  .app-user {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
  }
  .app-user > div {
    flex: 1 1 180px;
    gap: 0.1rem;
  }
  .app-user strong { font-size: 0.92rem; }
  .app-user span { font-size: 0.76rem; }
  .app-user .secondary-button {
    width: auto;
    min-width: 88px;
    min-height: 38px;
    padding: 0 0.9rem;
  }

  /* Horizontal scrollable tabs */
  .view-tabs {
    display: flex; flex-wrap: nowrap; overflow-x: auto;
    position: sticky;
    top: 0.45rem;
    z-index: 16;
    grid-template-columns: unset; gap: 0.55rem;
    padding: 0.38rem;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(6, 18, 28, 0.9);
    box-shadow: 0 14px 30px rgba(2, 8, 15, 0.22);
    backdrop-filter: blur(14px);
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 0.38rem;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
  .view-tabs::-webkit-scrollbar { display: none; }
  .tab-button {
    flex: 0 0 auto;
    min-width: 96px;
    min-height: 68px;
    padding: 0.7rem 0.8rem;
    border-radius: 15px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.32rem;
    font-size: 0.73rem;
    line-height: 1.15;
    white-space: normal;
    text-wrap: balance;
    scroll-snap-align: start;
    background: rgba(255, 255, 255, 0.045);
  }
  .tab-button i {
    font-size: 1.05rem;
    flex: 0 0 auto;
  }
  .tab-button.active {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(9, 32, 30, 0.28);
  }
}

@media (max-width: 640px) {
  .login-screen, .app-shell { padding: 0.75rem; }
  .login-screen::before,
  .login-screen::after { opacity: 0.45; }
  .login-shell {
    min-height: calc(100dvh - 1.5rem);
    align-items: center;
  }
  .login-card { border-radius: 20px; }
  .login-aside { padding: 1.55rem 1.2rem; }
  .login-aside__inner { gap: 1.2rem; }
  .login-screen .login-brand { gap: 0.75rem; }
  .login-screen .login-brand img { width: 56px; height: 56px; }
  .login-brand__subtitle { letter-spacing: 0.18em; }
  .login-hero h1 { font-size: clamp(1.8rem, 9vw, 2.4rem); }
  .login-hero p { max-width: none; font-size: 0.95rem; }
  .login-highlight { align-items: flex-start; font-size: 0.88rem; }
  .login-form-panel { padding: 1.4rem 1rem 1.25rem; }
  .login-form__header { margin-bottom: 1.25rem; }
  .login-form__header h2 { font-size: 1.8rem; }
  .login-form__footer { align-items: stretch; }
  .login-form__footer .text-button { width: 100%; text-align: left; }
  .card, .hero-strip, .modal-card { padding: 1rem; border-radius: 18px; }
  .app-header {
    padding: 0.8rem 0.85rem;
    border-radius: 18px;
  }
  .app-brand strong { font-size: 0.94rem; }
  .app-brand span { font-size: 0.76rem; }
  .menu-hero { padding: 1.1rem; gap: 1rem; }
  .menu-hero__text h2 { font-size: 1.45rem; }
  .module-grid { gap: 0.6rem; }
  .module-card {
    min-height: 0;
    padding: 1rem 1rem 0.95rem;
    align-items: flex-start;
    gap: 0.85rem;
  }
  .module-card__icon { width: 44px; height: 44px; }
  .module-card__arrow { display: none; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-card { padding: 0.8rem 0.85rem; }
  .summary-card strong { font-size: 1.25rem; }
  .profile-grid div, .feed-item, .empty-state { padding: 0.8rem; }
  .feed-item { display: grid; gap: 0.4rem; }
  .feed-item .inline-grid { margin-top: 0.15rem; }
  .budget-item-card-subitem { margin-left: 0.45rem; }
  .suffix-field input { padding-right: 6.2rem; }
  .suffix-field strong { right: 0.85rem; font-size: 0.82rem; }
  .modal { padding: 0.75rem; align-items: flex-start; }
  .modal-card { padding: 1.1rem; }
  .modal-note { font-size: 0.84rem; }
  .signature-canvas { height: 170px; }
  .signature-action-row,
  .signature-controls {
    flex-direction: column;
    gap: 0.5rem;
  }
  .signature-action-row button,
  .signature-controls .secondary-button,
  .signature-controls .primary-button {
    width: 100%;
    min-width: 0;
    flex: none;
  }
  .inline-grid { grid-template-columns: 1fr; }
  .form-stack { gap: 0.7rem; }
  .primary-button,
  .secondary-button,
  .table-action { width: 100%; }
  .app-user .secondary-button { width: auto; }
  input, select, textarea { font-size: 16px; }

  .table-host { overflow: visible; }
  .table-shell {
    min-width: 0;
    border: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
  }
  .table-shell table,
  .table-shell thead,
  .table-shell tbody,
  .table-shell tr,
  .table-shell td {
    display: block;
    width: 100%;
  }
  .table-shell thead { display: none; }
  .table-shell tbody {
    display: grid;
    gap: 0.75rem;
  }
  .table-shell tr {
    padding: 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.03);
  }
  .table-shell td {
    padding: 0;
    border: 0;
    display: grid;
    gap: 0.25rem;
  }
  .table-shell td + td { margin-top: 0.65rem; }
  .table-shell td::before {
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-soft);
  }
  .table-shell td[data-label=""]::before { display: none; }
  .table-shell td:last-child { margin-top: 0.9rem; }
  .table-shell td:last-child .table-action { width: 100%; }
}

@media (max-width: 460px) {
  .login-screen::before,
  .login-screen::after { display: none; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-card strong { font-size: 1.15rem; }
  .view-tabs {
    top: 0.35rem;
    gap: 0.45rem;
    padding: 0.32rem;
  }
  .tab-button {
    min-width: 88px;
    min-height: 64px;
    padding: 0.62rem 0.65rem;
    font-size: 0.7rem;
  }
  .app-user {
    align-items: flex-start;
  }
  .app-user > div {
    flex-basis: 100%;
  }
  .app-user .secondary-button {
    min-width: 82px;
  }
  .kicker, .field span, .profile-grid dt {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
  }
}
