/* ============================================================
   Client Portal - Cloud23
   Sistem de design: amber/warm, Fraunces + Public Sans + IBM Plex Mono
   ============================================================ */

:root {
  --bg: #fdfaf5;
  --surface: #ffffff;
  --surface2: #f6efe4;
  --border: #e8dcc8;
  --border2: #d8c8a8;
  --text: #241c12;
  --muted: #6b5f4d;
  --muted2: #9c8f78;
  --accent: #d98324;
  --accent-h: #b96c18;
  --accent-ink: #ffffff;
  --success: #4d8a5f;
  --success-soft: #e3efe3;
  --danger: #b9432f;
  --danger-soft: #f5e2dd;
  --warn: #c98a1f;
  --warn-soft: #f6e9d2;
  --shadow: 0 1px 2px rgba(36,28,18,0.04), 0 12px 28px -16px rgba(36,28,18,0.18);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17130d;
    --surface: #211b12;
    --surface2: #2a2217;
    --border: #3a3020;
    --border2: #4a3d28;
    --text: #f3ead9;
    --muted: #b8a98c;
    --muted2: #7d7057;
    --accent: #e6a13c;
    --accent-h: #f0b25a;
    --accent-ink: #17130d;
    --success: #7cc48f;
    --success-soft: #24352a;
    --danger: #e07a63;
    --danger-soft: #3a241f;
    --warn: #e6a13c;
    --warn-soft: #3a2e18;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 20px 44px -20px rgba(0,0,0,0.6);
  }
}

:root[data-theme="dark"] {
  --bg: #17130d;
  --surface: #211b12;
  --surface2: #2a2217;
  --border: #3a3020;
  --border2: #4a3d28;
  --text: #f3ead9;
  --muted: #b8a98c;
  --muted2: #7d7057;
  --accent: #e6a13c;
  --accent-h: #f0b25a;
  --accent-ink: #17130d;
  --success: #7cc48f;
  --success-soft: #24352a;
  --danger: #e07a63;
  --danger-soft: #3a241f;
  --warn: #e6a13c;
  --warn-soft: #3a2e18;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 20px 44px -20px rgba(0,0,0,0.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Public Sans', ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0 0 8px;
}

h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }

a { color: var(--accent); }

.mono {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}

/* ---------- Layout shells ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar .brand {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--text);
}

.topbar nav {
  display: flex;
  gap: 18px;
  align-items: center;
  font-size: 0.9rem;
}

.topbar nav a {
  color: var(--muted);
  text-decoration: none;
}
.topbar nav a:hover { color: var(--text); }

.shell {
  display: flex;
  min-height: calc(100vh - 57px);
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
}

.sidebar a {
  display: block;
  padding: 10px 22px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  border-left: 3px solid transparent;
}

.sidebar a:hover { color: var(--text); background: var(--surface2); }
.sidebar a.active {
  color: var(--accent-h);
  border-left-color: var(--accent);
  background: var(--surface2);
  font-weight: 600;
}

.content {
  flex: 1;
  min-width: 0;
  padding: 28px 32px;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px;
}

/* ---------- Components ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 20px;
}

.grid {
  display: grid;
  gap: 16px;
}
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 720px) {
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .shell { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 8px 0; }
  .content { padding: 20px; }
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat .label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted2);
}
.stat .value {
  font-family: 'Fraunces', serif;
  font-size: 1.7rem;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted2);
  font-weight: 500;
}
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok     { background: var(--success-soft); color: var(--success); }
.badge.warn   { background: var(--warn-soft);    color: var(--warn); }
.badge.danger { background: var(--danger-soft);  color: var(--danger); }
.badge.muted  { background: var(--surface2);     color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Public Sans', sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--muted2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 6px 11px; font-size: 0.82rem; }

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

form.inline { display: inline; }

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 5px;
}

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], select, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 9px 11px;
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.field { margin-bottom: 16px; }
.field .hint { font-size: 0.8rem; color: var(--muted2); margin-top: 4px; }

.flash {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 0.9rem;
}
.flash.success { background: var(--success-soft); color: var(--success); }
.flash.error   { background: var(--danger-soft);  color: var(--danger); }
.flash.info    { background: var(--surface2);     color: var(--muted); }

.muted { color: var(--muted); }
.empty {
  padding: 30px;
  text-align: center;
  color: var(--muted2);
  font-size: 0.9rem;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
}
