:root {
  --ink: #f8ede7;
  --muted: #c9b8b0;
  --paper: #171313;
  --panel: #211a1a;
  --card: #2a2020;
  --line: #4d3935;
  --accent: #c58b6b;
  --accent-dark: #f0c7a6;
  --accent-soft: rgba(197, 139, 107, 0.18);
  --rose: #d86f86;
  --amber: #d8a24c;
  --green: #66c69a;
  --blue: #79a9ff;
  --app-top: #0e0b0b;
  --auth-start: #0d0a0a;
  --auth-mid: #231818;
  --panel-alpha: rgba(33, 26, 26, 0.97);
  --button-bg: var(--accent);
  --button-text: #1b1110;
  --input-bg: #1d1717;
  --input-border: #5c443f;
  --tab-bg: rgba(255, 255, 255, 0.08);
  --tab-text: #f8ede7;
  --submenu-bg: #1a1313;
  --brand-gradient: linear-gradient(135deg, #1c1414, #c58b6b 52%, #f2cfad);
  --focus-ring: rgba(197, 139, 107, 0.24);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}

:root[data-theme="dark-pro"] {
  --ink: #eaf6f5;
  --muted: #9db3b5;
  --paper: #101820;
  --panel: #172431;
  --card: #1c2b39;
  --line: #2d4250;
  --accent: #22b8a8;
  --accent-dark: #7ee8dd;
  --accent-soft: rgba(34, 184, 168, 0.18);
  --rose: #e85d75;
  --amber: #d99022;
  --green: #4fd09a;
  --blue: #66a2ff;
  --app-top: #101820;
  --auth-start: #101820;
  --auth-mid: #172431;
  --panel-alpha: rgba(23, 36, 49, 0.97);
  --button-bg: #22b8a8;
  --button-text: #062320;
  --input-bg: #101820;
  --input-border: #344a58;
  --tab-bg: rgba(255, 255, 255, 0.11);
  --tab-text: #eff9f8;
  --submenu-bg: #14212d;
  --brand-gradient: linear-gradient(135deg, #6be6d7, #f6d36b);
  --focus-ring: rgba(34, 184, 168, 0.18);
}

:root[data-theme="light-clean"] {
  --ink: #1f242b;
  --muted: #6f7780;
  --paper: #f7f6f5;
  --panel: #ffffff;
  --card: #fbfaf9;
  --line: #ded8d3;
  --accent: #b98579;
  --accent-dark: #8b5d55;
  --accent-soft: rgba(185, 133, 121, 0.16);
  --rose: #cf6476;
  --amber: #c28a2e;
  --green: #217a56;
  --blue: #3b73d9;
  --app-top: #2a2525;
  --auth-start: #2a2525;
  --auth-mid: #eee7e3;
  --panel-alpha: rgba(255, 255, 255, 0.97);
  --button-bg: #b98579;
  --button-text: #ffffff;
  --input-bg: #ffffff;
  --input-border: #d6cec9;
  --tab-bg: rgba(255, 255, 255, 0.12);
  --tab-text: #fff7f3;
  --submenu-bg: #332b2b;
  --brand-gradient: linear-gradient(135deg, #fff6f1, #b98579);
  --focus-ring: rgba(185, 133, 121, 0.18);
}

:root[data-theme="soft-feminino"] {
  --ink: #3b2d2f;
  --muted: #826f70;
  --paper: #f7efeb;
  --panel: #fffaf7;
  --card: #fff6f1;
  --line: #eadbd5;
  --accent: #c88f9d;
  --accent-dark: #975d6c;
  --accent-soft: rgba(200, 143, 157, 0.18);
  --rose: #c96880;
  --amber: #c59645;
  --green: #4d8a66;
  --blue: #737fc8;
  --app-top: #4a363a;
  --auth-start: #4a363a;
  --auth-mid: #f2dfd7;
  --panel-alpha: rgba(255, 250, 247, 0.97);
  --button-bg: #c88f9d;
  --button-text: #2f1d22;
  --input-bg: #fffdfb;
  --input-border: #e5d4ce;
  --tab-bg: rgba(255, 255, 255, 0.14);
  --tab-text: #fff8f6;
  --submenu-bg: #5a4247;
  --brand-gradient: linear-gradient(135deg, #fff5ef, #d8a8b4);
  --focus-ring: rgba(200, 143, 157, 0.22);
}

:root[data-theme="rose-premium"] {
  --ink: #24171c;
  --muted: #7a5c66;
  --paper: #fff7f9;
  --panel: #ffffff;
  --card: #ffffff;
  --line: #f3cbd5;
  --accent: #d86b8c;
  --accent-dark: #c75378;
  --accent-soft: rgba(248, 215, 226, 0.78);
  --rose: #d94d72;
  --amber: #c79945;
  --green: #4b9b72;
  --blue: #7b77c8;
  --app-top: #2a171f;
  --auth-start: #2a171f;
  --auth-mid: #4d2635;
  --panel-alpha: rgba(255, 255, 255, 0.98);
  --button-bg: #d86b8c;
  --button-text: #ffffff;
  --input-bg: #fffafd;
  --input-border: #e8b9c7;
  --tab-bg: rgba(255, 255, 255, 0.12);
  --tab-text: #fff4f7;
  --submenu-bg: #3b202c;
  --brand-gradient: linear-gradient(135deg, #2a171f, #d86b8c 58%, #f8d7e2);
  --focus-ring: rgba(216, 107, 140, 0.22);
  --shadow: 0 18px 60px rgba(80, 27, 45, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, var(--app-top) 0, var(--app-top) 172px, var(--paper) 173px),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.is-hidden,
.admin-only.is-hidden,
.professor-only.is-hidden {
  display: none !important;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(135deg, var(--accent-soft), transparent 42%),
    linear-gradient(180deg, var(--auth-start) 0, var(--auth-mid) 58%, var(--paper) 58%);
}

.auth-panel,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-alpha);
  box-shadow: var(--shadow);
}

.auth-panel {
  width: min(460px, 100%);
  padding: 28px;
}

.brand-mark {
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  border-radius: 8px;
  color: var(--button-text);
  background: var(--brand-gradient);
  font-size: 1.35rem;
  font-weight: 950;
  letter-spacing: 0;
}

.brand-mark.small {
  width: 46px;
  height: 46px;
  font-size: 1rem;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-panel .eyebrow {
  margin-top: 18px;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
}

.auth-panel h1 {
  font-size: clamp(2rem, 8vw, 3.4rem);
}

.auth-copy {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form,
.form-panel {
  display: grid;
  gap: 14px;
}

.auth-form {
  margin-top: 24px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 760;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--input-bg);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.primary-btn,
.secondary-btn,
.chip-btn,
.icon-btn,
.danger-btn,
.ghost-btn {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 850;
}

.primary-btn {
  color: var(--button-text);
  background: var(--button-bg);
  box-shadow: 0 12px 24px var(--accent-soft);
}

.secondary-btn,
.chip-btn,
.ghost-btn {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--card);
}

.danger-btn {
  color: #fff;
  background: var(--rose);
}

.icon-btn {
  width: 42px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.feedback {
  min-height: 20px;
  margin: 0;
  color: var(--accent-dark);
  font-size: 0.88rem;
  font-weight: 750;
}

.demo-box {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.demo-box p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.demo-actions,
.actions-row,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-btn,
.row-actions button {
  padding: 0 12px;
}

.app-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  color: #fff;
}

.brand-row,
.user-area {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-row p {
  margin: 0 0 2px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.brand-row h1 {
  font-size: clamp(1.05rem, 3vw, 1.45rem);
}

.user-badge,
.version-badge {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 0 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.88rem;
  font-weight: 800;
}

.user-badge {
  max-width: 42vw;
}

.version-badge {
  color: var(--button-text);
  background: var(--accent);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow: visible;
  padding: 10px 0 18px;
}

.tab {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 0 14px;
  white-space: nowrap;
  color: #eff9f8;
  color: var(--tab-text);
  background: var(--tab-bg);
  font-weight: 850;
}

.tab.is-active,
.tab-menu.is-open > .tab,
.tab-menu.is-active > .tab {
  color: #062320;
  color: var(--button-text);
  background: var(--accent);
}

.tab-menu {
  position: relative;
  flex: 0 0 auto;
}

.tab-menu-trigger {
  width: 100%;
}

.tab-submenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  display: none;
  min-width: 180px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: var(--submenu-bg);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
}

.tab-menu:hover .tab-submenu,
.tab-menu:focus-within .tab-submenu,
.tab-menu.is-open .tab-submenu {
  display: grid;
  gap: 6px;
}

.tab-subitem {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: #eff9f8;
  color: var(--tab-text);
  background: transparent;
  text-align: left;
  font-weight: 800;
  white-space: nowrap;
}

.tab-subitem:hover,
.tab-subitem.is-active {
  color: #062320;
  color: var(--button-text);
  background: var(--accent);
}

.view {
  display: none;
}

.view.is-active {
  display: grid;
  gap: 16px;
}

.view-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-top: 4px;
}

.view-head h2 {
  font-size: clamp(1.45rem, 5vw, 2.35rem);
}

.month-filter {
  width: min(220px, 100%);
}

.panel {
  padding: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 12px;
}

.metric-card {
  min-height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
  box-shadow: 0 10px 24px var(--accent-soft);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.3rem, 3vw, 2rem);
  line-height: 1.05;
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.two-column,
.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.section-title {
  margin-bottom: 14px;
}

.section-title p {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.responsive-table {
  overflow-x: auto;
}

.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.table-actions .ghost-btn,
.table-actions .danger-btn {
  min-height: 34px;
  padding: 0 10px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  color: var(--ink);
  font-size: 0.9rem;
}

.status-pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.78rem;
  font-weight: 900;
}

.status-pendente {
  color: #5f3a00;
  background: #ffe6ad;
}

.status-aprovado {
  color: #07553a;
  background: #c9f5df;
}

.status-rejeitado,
.status-cancelado {
  color: #7c162c;
  background: #ffd5de;
}

.status-pago {
  color: #123c83;
  background: #dbe8ff;
}

.form-grid,
.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .wide,
.filters-grid .wide {
  grid-column: span 2;
}

.form-grid .full,
.filters-grid .full {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.list-panel {
  display: grid;
  align-content: start;
  gap: 10px;
}

.list-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--card);
}

.list-card h3 {
  font-size: 1rem;
}

.list-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.list-card footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.invoice-box,
.warning-list {
  display: grid;
  gap: 10px;
  color: var(--ink);
  line-height: 1.5;
}

.invoice-box strong {
  display: block;
  font-size: 1.25rem;
}

.warning-item {
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  padding: 12px;
  background: var(--accent-soft);
}

.empty-state {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 12px;
}

.theme-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--card);
}

.theme-preview {
  display: grid;
  gap: 8px;
  min-height: 108px;
  border-radius: 8px;
  padding: 12px;
  background: var(--preview-bg);
}

.theme-preview-bar {
  height: 18px;
  border-radius: 6px;
  background: var(--preview-accent);
}

.theme-preview-row {
  display: grid;
  grid-template-columns: 1fr 0.55fr;
  gap: 8px;
}

.theme-preview-card {
  min-height: 54px;
  border: 1px solid var(--preview-line);
  border-radius: 8px;
  background: var(--preview-card);
}

.theme-card h3 {
  font-size: 1rem;
}

.theme-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.theme-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.theme-active-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--button-text);
  background: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
}

.theme-preview.signature {
  --preview-bg: #151010;
  --preview-card: #2a2020;
  --preview-line: #5a4038;
  --preview-accent: #c58b6b;
}

.theme-preview.dark-pro {
  --preview-bg: #101820;
  --preview-card: #1c2b39;
  --preview-line: #2d4250;
  --preview-accent: #22b8a8;
}

.theme-preview.light-clean {
  --preview-bg: #f7f6f5;
  --preview-card: #ffffff;
  --preview-line: #ded8d3;
  --preview-accent: #b98579;
}

.theme-preview.soft-feminino {
  --preview-bg: #f7efeb;
  --preview-card: #fff6f1;
  --preview-line: #eadbd5;
  --preview-accent: #c88f9d;
}

.theme-preview.rose-premium {
  --preview-bg: #fff7f9;
  --preview-card: #ffffff;
  --preview-line: #f3cbd5;
  --preview-accent: #d86b8c;
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .form-grid,
  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .theme-grid {
    grid-template-columns: repeat(2, minmax(190px, 1fr));
  }
}

@media (max-width: 780px) {
  body {
    background:
      linear-gradient(180deg, var(--app-top) 0, var(--app-top) 156px, var(--paper) 157px),
      var(--paper);
  }

  .app-shell {
    padding: 12px;
  }

  .topbar,
  .view-head {
    align-items: stretch;
    flex-direction: column;
  }

  .user-area {
    justify-content: space-between;
  }

  .month-filter {
    width: 100%;
  }

  .metric-grid,
  .two-column,
  .split-layout,
  .form-grid,
  .filters-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .wide,
  .filters-grid .wide {
    grid-column: auto;
  }

  .auth-panel,
  .panel {
    padding: 16px;
  }

  table {
    min-width: 860px;
  }

  .theme-grid {
    grid-template-columns: 1fr;
  }
}
