:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fbff;
  --ink: #111827;
  --muted: #667085;
  --line: #dfe6f2;
  --blue: #0047ff;
  --cyan: #00a6ff;
  --danger: #dc2626;
  --success: #16a34a;
  --dark: #070a12;
  --radius: 8px;
  --shadow: 0 18px 48px rgba(17, 24, 39, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: 0;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  background:
    radial-gradient(circle at 22% 30%, rgba(0, 71, 255, 0.3), transparent 28%),
    linear-gradient(135deg, #070a12, #101827 48%, #182235);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  padding: clamp(28px, 5vw, 72px);
  color: #fff;
}

.auth-logo, .sidebar-logo { width: 160px; }

.auth-logo-carmesp {
  width: min(360px, 100%);
}

.sidebar-logo-carmesp {
  width: 100%;
}
.auth-message { max-width: 620px; }

.auth-message h1 {
  margin: 0 0 20px;
  font-size: clamp(2.45rem, 5vw, 5rem);
  line-height: 0.98;
}

.auth-message p, .auth-help, .hint, .panel-header p {
  color: var(--muted);
  line-height: 1.6;
}

.auth-message p { color: #b9c3d7; font-size: 1.08rem; }

.auth-panel-wrap {
  display: grid;
  align-items: center;
  padding: clamp(20px, 4vw, 60px);
}

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

.auth-panel {
  width: min(480px, 100%);
  margin: 0 auto;
  padding: 30px;
}

.auth-panel h2, .page-title h1, .panel h2, .empty-state h2 {
  margin: 0;
  line-height: 1.1;
}

.auth-panel h2 { font-size: 1.9rem; }
.auth-help { margin: 10px 0 24px; }

.auth-link {
  color: var(--blue);
  font-weight: 800;
  text-align: center;
}

.role-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 22px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.role-toggle a {
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
}

.role-toggle a.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
}

.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; gap: 8px; }

label {
  color: #344054;
  font-size: 0.88rem;
  font-weight: 800;
}

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

textarea { min-height: 96px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 71, 255, 0.12);
}

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 800;
  text-decoration: none;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  box-shadow: 0 12px 32px rgba(0, 71, 255, 0.24);
}

.btn-ghost { color: var(--ink); border-color: var(--line); background: #fff; }
.btn-danger { color: #fff; background: var(--danger); }
.btn-small { min-height: 34px; padding: 0 11px; font-size: 0.84rem; }

.alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  color: #1849a9;
  background: #dbeafe;
  font-weight: 700;
  line-height: 1.5;
}

.alert-danger { color: #b42318; background: #fee4e2; }
.alert-success { color: #067647; background: #dcfae6; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px;
  color: #fff;
  background:
    radial-gradient(circle at 18% 22%, rgba(0, 166, 255, 0.18), transparent 34%),
    linear-gradient(180deg, #05070d, #111827);
}

.sidebar-logo { margin-bottom: 34px; }

.sidebar-logo-link {
  display: block;
  margin-bottom: 34px;
}

.sidebar-logo-link .sidebar-logo {
  margin-bottom: 0;
}

.nav-list { display: grid; gap: 8px; }

.nav-list a,
.nav-group > span {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: #bdc7da;
  font-weight: 800;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-group > span {
  min-height: 30px;
  color: #fff;
  opacity: 0.72;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.nav-group:hover > span {
  opacity: 1;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
}

.nav-group.is-active > span {
  opacity: 1;
  color: var(--cyan);
}

.nav-group a {
  min-height: 38px;
  margin-left: 10px;
  font-size: 0.92rem;
}

.nav-list a.is-active, .nav-list a:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
  color: #aab4c8;
  font-size: 0.9rem;
}

.dev-credit {
  display: grid;
  gap: 8px;
  color: #aab4c8;
  font-size: 0.78rem;
  font-weight: 700;
}

.dev-credit img {
  width: 104px;
  opacity: 0.9;
}

.dev-credit-auth {
  color: #b9c3d7;
}

.main { min-width: 0; padding: 28px clamp(20px, 4vw, 44px) 44px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.page-title p { margin: 8px 0 0; color: var(--muted); }
.page-title h1 { font-size: clamp(1.9rem, 4vw, 3rem); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat { padding: 18px; }
.stat strong { display: block; margin-bottom: 4px; font-size: 1.8rem; }
.stat span { color: var(--muted); font-size: 0.9rem; font-weight: 700; }

.panel { padding: 20px; }
.panel + .panel { margin-top: 18px; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-header p { margin: 7px 0 0; }

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 180px 150px;
  gap: 12px;
  margin-bottom: 16px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

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

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

th {
  color: #475467;
  background: #f8fbff;
  font-size: 0.82rem;
  text-transform: uppercase;
}

tr:last-child td { border-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.badge-active { color: #067647; background: #dcfae6; }
.badge-inactive { color: #b42318; background: #fee4e2; }
.badge-admin { color: #1849a9; background: #dbeafe; }

.two-col {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.file-drop {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px dashed #a8b7d5;
  border-radius: var(--radius);
  background: #f8fbff;
}

.empty-state {
  padding: 34px;
  border: 1px dashed #b8c4d9;
  border-radius: var(--radius);
  text-align: center;
  background: #f8fbff;
}

.empty-state p {
  margin: 10px auto 0;
  max-width: 520px;
  color: var(--muted);
  line-height: 1.6;
}

.process-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.process-card {
  display: grid;
  gap: 8px;
  min-height: 104px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.process-card.is-active,
.process-card:hover {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 71, 255, 0.1);
}

.process-card strong {
  font-size: 1.15rem;
}

.process-card span {
  color: var(--muted);
  line-height: 1.45;
}

.folder-block + .folder-block {
  margin-top: 22px;
}

.folder-block h3 {
  margin: 0 0 12px;
}

@media (max-width: 980px) {
  .auth-shell, .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav-list { grid-template-columns: repeat(4, 1fr); }
  .stats-grid, .two-col, .process-grid { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .auth-brand { padding-bottom: 0; }
  .auth-message h1 { font-size: 2.35rem; }
  .auth-panel { padding: 20px; }
  .main { padding: 20px 16px 34px; }
  .topbar, .panel-header { flex-direction: column; align-items: stretch; }
  .nav-list, .stats-grid, .two-col, .process-grid { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
  .btn { width: 100%; }
}
