/* Welcome English — identidade visual acolhedora, clara e leve (§23). */
:root {
  --brand: #E76F51;
  --brand-dark: #D65a3c;
  --brand-soft: #FCEDE7;
  --accent: #2A9D8F;
  --accent-soft: #E6F4F1;
  --bg: #FBF7F3;
  --card: #FFFFFF;
  --text: #3D3A38;
  --muted: #8A827D;
  --line: #EEE5DC;
  --ok: #2A9D8F;
  --warn: #E9A23B;
  --danger: #D9534F;
  --shadow: 0 6px 24px rgba(120, 90, 70, .08);
  --shadow-sm: 0 2px 8px rgba(120, 90, 70, .06);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0 0 .2em; font-weight: 800; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #fff, #FDF6F0);
  border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 12px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none;
}
.brand b { font-size: 15px; display: block; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 11.5px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px;
  color: var(--text); cursor: pointer; font-weight: 600; font-size: 14px; transition: .15s; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--brand-soft); }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.nav-item .ic { font-size: 17px; width: 20px; text-align: center; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 4px; }
.sidebar .spacer { flex: 1; }

.main { padding: 26px 34px 60px; width: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
.topbar h1 { font-size: 24px; }
.topbar .sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }

/* ---------- Cards & grid ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card + .card { margin-top: 16px; }
.card h3 { font-size: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

.stat {
  background: var(--card); border-radius: var(--radius); padding: 18px 18px 16px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--line); position: relative; overflow: hidden;
}
.stat .n { font-size: 30px; font-weight: 800; color: var(--brand); line-height: 1; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 8px; font-weight: 600; }
.stat .ic { position: absolute; right: 14px; top: 14px; font-size: 22px; opacity: .5; }
.stat.accent .n { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 11px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font-weight: 700; font-size: 14px; cursor: pointer; transition: .15s; font-family: inherit;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { filter: brightness(.95); color: #fff; }
.btn-ghost { background: none; border-color: transparent; }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Badges / pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--brand-soft); color: var(--brand-dark); white-space: nowrap; }
.pill.green { background: var(--accent-soft); color: #1f7a6f; }
.pill.gray { background: #F0EBE5; color: var(--muted); }
.pill.yellow { background: #FBF0DA; color: #9a6a12; }
.pill.red { background: #FBE7E6; color: #b23b37; }
.pill.blue { background: #E7EFFB; color: #2f5fa0; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--line); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--brand-soft); }
.table .name { font-weight: 700; }
.table-wrap { overflow-x: auto; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
label.field { display: block; }
label.field > span { display: block; font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px;
  font-family: inherit; background: #fff; color: var(--text); transition: .15s;
}
.input:focus, textarea.input:focus, select.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea.input { resize: vertical; min-height: 74px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; cursor: pointer; padding: 6px 0; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
.section-title { font-size: 13px; font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: .05em; margin: 18px 0 4px; grid-column: 1 / -1; border-top: 1px dashed var(--line); padding-top: 14px; }
.section-title:first-child { border-top: none; padding-top: 0; margin-top: 0; }

/* ---------- Toolbar / search ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 180px; }
.search { position: relative; }
.search input { padding-left: 34px; }
.search::before { content: '🔎'; position: absolute; left: 11px; top: 8px; opacity: .6; font-size: 14px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 10px 14px; cursor: pointer; font-weight: 700; color: var(--muted); border: none; background: none; font-size: 14px; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; font-family: inherit; }
.tab:hover { color: var(--brand); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(60, 45, 38, .38); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 50; padding: 24px; }
.modal { background: var(--card); border-radius: 20px; width: 100%; max-width: 720px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(60,45,38,.25); }
.modal.wide { max-width: 940px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 2; border-radius: 20px 20px 0 0; }
.modal-head h2 { font-size: 19px; }
.modal-body { padding: 22px 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: #fff; border-radius: 0 0 20px 20px; }
.x { cursor: pointer; font-size: 22px; color: var(--muted); background: none; border: none; line-height: 1; }
.x:hover { color: var(--danger); }

/* ---------- Toast ---------- */
#toasts { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast { background: var(--text); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; font-size: 14px; animation: slidein .25s; max-width: 340px; }
.toast.ok { background: var(--accent); }
.toast.err { background: var(--danger); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } }

/* ---------- Misc ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; }
.kv dt { color: var(--muted); font-weight: 700; font-size: 13px; }
.kv dd { margin: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-weight: 800; flex: none; }
.list-note { background: var(--brand-soft); border-radius: 12px; padding: 12px 16px; color: var(--brand-dark); font-size: 13.5px; }
hr.soft { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% -10%, #FCEDE7, var(--bg)); padding: 20px; }
.login-card { background: #fff; border-radius: 22px; box-shadow: var(--shadow); padding: 40px 38px; width: 100%; max-width: 400px; text-align: center; }
.login-card .logo { width: 60px; height: 60px; border-radius: 18px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 800; margin: 0 auto 16px; }
.login-card h1 { font-size: 22px; }
.login-card p { color: var(--muted); margin-top: 4px; margin-bottom: 26px; }
.login-card label { text-align: left; }

/* Tablet e mobile */
@media (max-width: 1200px) {
  .grid.cols-4 { grid-template-columns: repeat(3, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: -260px; width: 250px; transition: .2s; box-shadow: var(--shadow); }
  .sidebar.open { left: 0; }
  .main { padding: 18px; }
  .form-grid, .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .menu-toggle { display: inline-flex !important; }
}

@media (max-width: 480px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .main { padding: 14px; }
  .card { padding: 14px; }
}

.menu-toggle { display: none; }
