/* ============================================================
   Studio Solyra — Design tokens
   Paleta extraída do logo: verde sálvia + creme, acento terracota
   ============================================================ */
:root {
  --sage-900: #3f4a37;
  --sage-800: #4f5c46;
  --sage-700: #647259;
  --sage-600: #7a8a6f;
  --sage-500: #909f85;
  --sage-100: #e7ebe2;
  --cream: #f6f2e9;
  --cream-dim: #ece6d6;
  --terracotta: #c16b47;
  --terracotta-dark: #a8583a;
  --ink: #262b22;
  --ink-soft: #5b6354;
  --danger: #b3452f;
  --success: #4f7a52;
  --warning: #c1913f;

  --font-display: "Playfair Display", "Iowan Old Style", "Georgia", serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-card: 0 10px 30px -12px rgba(38, 43, 34, 0.25);
  --shadow-pop: 0 18px 45px -16px rgba(38, 43, 34, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .brand-word {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0;
}
a { color: inherit; }
button { font-family: inherit; }

/* ---------- Login screen ---------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--cream);
}
@media (max-width: 860px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { display: none; }
}
.login-visual {
  position: relative;
  overflow: hidden;
  background: var(--sage-700);
}
.login-visual img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.92;
}
.login-visual::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(63,74,55,0.15) 0%, rgba(38,43,34,0.55) 100%);
}
.login-visual .visual-caption {
  position: absolute; left: 32px; right: 32px; bottom: 36px;
  color: var(--cream);
  z-index: 2;
}
.login-visual .visual-caption p {
  font-family: var(--font-display);
  font-size: 1.4rem;
  margin: 0;
  line-height: 1.35;
}
.login-visual .visual-caption span {
  display: block;
  margin-top: 8px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}

.login-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
}
.login-form {
  width: 100%;
  max-width: 380px;
}
.login-form .subtitle {
  color: var(--ink-soft);
  margin: 10px 0 34px;
  font-size: 0.95rem;
}
.field {
  margin-bottom: 18px;
}
.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--sage-800);
  margin-bottom: 6px;
}
.field input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--sage-100);
  background: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--ink);
}
.field input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--sage-600);
  box-shadow: 0 0 0 3px rgba(122,138,111,0.18);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  width: 100%;
  background: var(--sage-800);
  color: var(--cream);
}
.btn-primary:hover { background: var(--sage-900); }
.btn-secondary {
  background: var(--sage-100);
  color: var(--sage-900);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
}
.btn-danger { background: var(--danger); color: #fff; }
.form-error {
  background: rgba(179,69,47,0.1);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.85rem;
  margin-bottom: 16px;
  display: none;
}
.form-error.visible { display: block; }
.login-demo-hint {
  margin-top: 26px;
  padding: 14px 16px;
  background: var(--sage-100);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--sage-900);
  line-height: 1.5;
}

/* ---------- Logo ---------- */
.solyra-logo { color: var(--ink); }
.solyra-logo .eyebrow {
  display: block;
  font-family: var(--font-body);
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  color: var(--sage-700);
  margin-bottom: 2px;
}
.solyra-logo .word {
  font-family: var(--font-display);
  font-size: 2.4rem;
  letter-spacing: 0.06em;
  color: var(--sage-900);
}
.solyra-logo .tagline {
  display: block;
  font-family: var(--font-body);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: var(--sage-700);
  margin-top: 4px;
}
.solyra-logo.on-dark { color: var(--cream); }
.solyra-logo.on-dark .word { color: var(--cream); }
.solyra-logo.on-dark .eyebrow,
.solyra-logo.on-dark .tagline { color: var(--sage-100); opacity: 0.85; }
.solyra-logo.small .word { font-size: 1.35rem; }
.solyra-logo.small .eyebrow { font-size: 0.6rem; }
.solyra-logo.small .tagline { font-size: 0.55rem; }

/* ---------- App shell ---------- */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}
@media (max-width: 780px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; height: 100vh; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
}
.sidebar {
  background: var(--sage-900);
  color: var(--cream);
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
}
.sidebar .sidebar-header {
  padding: 4px 8px 26px;
  border-bottom: 1px solid rgba(246,242,233,0.12);
  margin-bottom: 18px;
}
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--sage-100);
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
}
.sidebar .nav-item:hover { background: rgba(246,242,233,0.08); color: var(--cream); }
.sidebar .nav-item.active {
  background: var(--terracotta);
  color: #fff;
}
.sidebar .nav-icon { font-size: 1.05rem; width: 22px; text-align: center; }
.sidebar-footer {
  border-top: 1px solid rgba(246,242,233,0.12);
  padding-top: 16px;
  margin-top: 12px;
}
.sidebar-user {
  font-size: 0.82rem;
  margin-bottom: 10px;
}
.sidebar-user .name { color: var(--cream); font-weight: 600; display:block; }
.sidebar-user .role { color: var(--sage-100); opacity: 0.75; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }

.app-main { display: flex; flex-direction: column; min-width: 0; }
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: #fff;
  border-bottom: 1px solid var(--sage-100);
}
.app-topbar h1 { font-size: 1.3rem; color: var(--sage-900); }
.topbar-toggle { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--sage-900); }
@media (max-width: 780px) { .topbar-toggle { display: block; } }
.app-content { padding: 28px; flex: 1; overflow-y: auto; }

/* ---------- Content building blocks ---------- */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-header p { color: var(--ink-soft); margin-top: 6px; font-size: 0.9rem; }

.card {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--sage-100);
  box-shadow: var(--shadow-card);
}
.card-pad { padding: 22px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}
.kpi-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--sage-100);
  box-shadow: var(--shadow-card);
}
.kpi-card .label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
.kpi-card .value { font-family: var(--font-display); font-size: 1.9rem; color: var(--sage-900); margin: 6px 0 8px; }
.kpi-card .bar-track { height: 6px; background: var(--sage-100); border-radius: 4px; overflow: hidden; }
.kpi-card .bar-fill { height: 100%; background: var(--terracotta); }
.kpi-card .bar-fill.ok { background: var(--success); }
.kpi-card .sub { font-size: 0.75rem; color: var(--ink-soft); margin-top: 6px; }

.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data-table th {
  text-align: left; padding: 10px 14px; background: var(--sage-100);
  color: var(--sage-900); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em;
  position: sticky; top: 0;
}
table.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--cream-dim); vertical-align: top; }
table.data-table tr:hover td { background: var(--cream); }

table.data-table.compact { font-size: 0.78rem; }
table.data-table.compact th { padding: 7px 10px; font-size: 0.66rem; }
table.data-table.compact td { padding: 6px 10px; }
table.data-table.compact .progress-row .pct { font-size: 0.7rem; width: 32px; }
table.data-table.compact .badge { font-size: 0.68rem; padding: 2px 8px; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 100px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em;
}
.badge-green { background: rgba(79,122,82,0.14); color: var(--success); }
.badge-amber { background: rgba(193,145,63,0.16); color: var(--warning); }
.badge-terracotta { background: rgba(193,107,71,0.15); color: var(--terracotta-dark); }
.badge-gray { background: var(--sage-100); color: var(--ink-soft); }
.badge-sage { background: rgba(122,138,111,0.2); color: var(--sage-700); }
.badge-plum { background: rgba(138,90,107,0.16); color: #8a5a6b; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .spacer { flex: 1; }
.toolbar select, .toolbar input { padding: 9px 12px; }

.empty-state {
  text-align: center; padding: 60px 20px; color: var(--ink-soft);
}
.empty-state .icon { font-size: 2.2rem; margin-bottom: 10px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(38,43,34,0.45);
  display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px;
}
.modal {
  background: #fff; border-radius: var(--radius-md); width: 100%; max-width: 560px;
  max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-pop);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--sage-100); }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--sage-100); display: flex; justify-content: flex-end; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } }

.checklist-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 4px;
  border-bottom: 1px solid var(--cream-dim);
}
.checklist-item.depth-1 { padding-left: 22px; }
.checklist-item.depth-2 { padding-left: 40px; }
.checklist-item .item-label { flex: 1; font-size: 0.88rem; }
.checklist-item.done .item-label { color: var(--ink-soft); text-decoration: line-through; }
.checklist-item.na .item-label { color: var(--ink-soft); font-style: italic; opacity: 0.65; }

.notes-dot {
  position: absolute; top: 4px; right: 2px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--terracotta);
}

.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .bar-track { flex: 1; height: 8px; background: var(--sage-100); border-radius: 4px; overflow: hidden; }
.progress-row .bar-fill { height: 100%; background: var(--terracotta); }
.progress-row .pct { font-size: 0.78rem; color: var(--ink-soft); width: 38px; text-align: right; }

.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
@media (max-width: 760px) { .calc-grid { grid-template-columns: 1fr; } }
.pacotes-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .pacotes-grid { grid-template-columns: 1fr; } }
.calc-result {
  background: var(--sage-900); color: var(--cream); border-radius: var(--radius-md);
  padding: 26px; text-align: center;
}
.calc-result .value { font-family: var(--font-display); font-size: 2.4rem; margin: 8px 0; color: #fff; }
.calc-result .label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.8; }
.calc-subbox { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14); border-radius: 10px; padding: 14px 16px; margin: 16px 0; text-align: left; }
.calc-subbox-title { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.75; margin-bottom: 8px; }
.calc-subbox-row { display: flex; justify-content: space-between; gap: 10px; font-size: 0.85rem; padding: 4px 0; opacity: 0.9; }
.calc-subbox-row.total { border-top: 1px solid rgba(255,255,255,0.16); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 0.95rem; opacity: 1; }

.tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn {
  padding: 9px 16px; border-radius: 100px; border: 1px solid var(--sage-100);
  background: #fff; color: var(--ink-soft); cursor: pointer; font-size: 0.85rem;
}
.tab-btn.active { background: var(--sage-800); color: var(--cream); border-color: var(--sage-800); }

.role-guard-message {
  padding: 60px 20px; text-align: center; color: var(--ink-soft);
}
