/* PermaTasks — estilos. Nenhuma cor fica escrita nos componentes: tudo vem das variáveis abaixo.
   Para trocar a identidade visual, mude só --blue, --orange e --side-bg. */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/vendor/fonts/inter-latin.woff2') format('woff2');
}

:root {
  --blue: #5E69C5; --blue-600: #414CA8; --blue-soft: #E6E8F7; --on-blue: #FFFFFF; /* cor principal */
  --orange: #FF562F; --orange-soft: #FFE5DE;                                      /* destaque */
  --clarity: #A7AFE6; --black: #011337;
  --bg: #F2F2F2; --surface: #FFFFFF; --surface-2: #F7F7F8; --surface-3: #EDEEF0;
  --border: #E3E5E8; --border-strong: #CDD1D6;
  --text: #1E1E1E; --text-2: #565C66; --text-3: #8A909B;
  --side-bg: #011337; --side-text: #D6D8DC; --side-muted: #8A909B;
  --side-hover: rgba(255,255,255,.07); --side-active: rgba(255,255,255,.12);
  --good: #1F9D55; --good-soft: #E3F5EB; --warn: #B7791F; --warn-soft: #FDF3DC; --bad: #D93D3D; --bad-soft: #FDE8E8;
  --radius: 10px; --radius-sm: 7px; --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20,22,26,.06);
  --shadow: 0 4px 16px rgba(20,22,26,.08), 0 1px 2px rgba(20,22,26,.06);
  --shadow-lg: 0 16px 48px rgba(20,22,26,.18), 0 2px 6px rgba(20,22,26,.08);
  --side-w: 264px; --ring: 0 0 0 3px rgba(94,105,197,.30);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --blue: #8A93E0; --blue-600: #A5ACEB; --blue-soft: rgba(138,147,224,.16); --on-blue: #0B1030;
  --orange: #FF6B47; --orange-soft: rgba(255,107,71,.16);
  --bg: #121316; --surface: #1B1D22; --surface-2: #20232A; --surface-3: #292C34;
  --border: #2B2E36; --border-strong: #3A3E48;
  --text: #F2F2F2; --text-2: #B3B8C2; --text-3: #7F8591;
  --side-bg: #060A1C; --side-hover: rgba(255,255,255,.06); --side-active: rgba(255,255,255,.1);
  --good: #4CC585; --good-soft: rgba(76,197,133,.14); --warn: #E6B450; --warn-soft: rgba(230,180,80,.14);
  --bad: #F27272; --bad-soft: rgba(242,114,114,.14);
  --shadow: 0 4px 16px rgba(0,0,0,.4); --shadow-lg: 0 16px 48px rgba(0,0,0,.6); --ring: 0 0 0 3px rgba(138,147,224,.40);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --blue: #8A93E0; --blue-600: #A5ACEB; --blue-soft: rgba(138,147,224,.16); --on-blue: #0B1030;
    --orange: #FF6B47; --orange-soft: rgba(255,107,71,.16);
    --bg: #121316; --surface: #1B1D22; --surface-2: #20232A; --surface-3: #292C34;
    --border: #2B2E36; --border-strong: #3A3E48;
    --text: #F2F2F2; --text-2: #B3B8C2; --text-3: #7F8591;
    --side-bg: #060A1C; --side-hover: rgba(255,255,255,.06); --side-active: rgba(255,255,255,.1);
    --good: #4CC585; --good-soft: rgba(76,197,133,.14); --warn: #E6B450; --warn-soft: rgba(230,180,80,.14);
    --bad: #F27272; --bad-soft: rgba(242,114,114,.14);
    --shadow: 0 4px 16px rgba(0,0,0,.4); --shadow-lg: 0 16px 48px rgba(0,0,0,.6); --ring: 0 0 0 3px rgba(138,147,224,.40);
    color-scheme: dark;
  }
}

/* ───────── Base ───────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 var(--font); font-feature-settings: 'cv11', 'ss01'; -webkit-font-smoothing: antialiased;
}
::selection { background: color-mix(in srgb, var(--blue) 25%, transparent); }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; font-weight: 650; }
p { margin: 0; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--ring); border-radius: var(--radius-sm); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ───────── Botões e campos ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 550; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--on-blue); }
.btn-primary:hover { background: var(--blue-600); border-color: var(--blue-600); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-block { width: 100%; height: 40px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 550; font-size: 13px; }
.field .hint { font-size: 12px; color: var(--text-3); }
.input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit;
}
.input:focus { border-color: var(--blue); box-shadow: var(--ring); }
.input::placeholder { color: var(--text-3); }

.alert { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.alert-bad { background: var(--bad-soft); color: var(--bad); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }

.avatar {
  display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%;
  color: #fff; font-size: 12px; font-weight: 650; letter-spacing: 0;
}
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }

/* ───────── Login e instalação ───────── */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 32px 28px;
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card .lead { color: var(--text-2); margin-bottom: 22px; }
.logo-mark {
  display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 9px;
  background: var(--side-bg);
}
.side .logo-mark { background: var(--side-active); } /* destaca o logo sobre a barra escura */
.logo-name { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }

/* ───────── Shell ───────── */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: 100dvh; }
.app.side-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.side {
  background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column;
  min-width: 0; overflow: hidden; width: var(--side-w);
}
.app.side-collapsed .side { visibility: hidden; }
.side-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 10px; }
.side-head .logo-name { color: #fff; flex: 1; }
.side .icon-btn { color: var(--side-muted); }
.side .icon-btn:hover { background: var(--side-hover); color: #fff; }
.side-scroll { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--side-text);
  text-align: left; text-decoration: none; font-weight: 500;
}
.nav-item:hover { background: var(--side-hover); text-decoration: none; }
.nav-item.active { background: var(--side-active); color: #fff; }
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.side-label {
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 10px 6px; font-size: 11px; font-weight: 650; letter-spacing: .06em;
  text-transform: uppercase; color: var(--side-muted);
}
.side-empty { margin: 4px 10px; font-size: 13px; color: var(--side-muted); }
.side-foot { padding: 10px 8px; border-top: 1px solid var(--side-hover); position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0;
  border-radius: var(--radius-sm); background: transparent; color: var(--side-text); text-align: left;
}
.user-btn:hover { background: var(--side-hover); }
.user-btn .who { flex: 1; min-width: 0; }
.user-btn .who b { display: block; color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-btn .who span { font-size: 12px; color: var(--side-muted); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  display: flex; align-items: center; gap: 8px; height: 52px; flex: none; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--text-2); min-width: 0; }
.crumbs b { color: var(--text); font-weight: 600; }
.menu-btn { display: none; }
.app.side-collapsed .menu-btn { display: inline-grid; }
.content { flex: 1; overflow-y: auto; padding: 28px 32px; }
.page { max-width: 960px; margin: 0 auto; }
.page h1 { font-size: 22px; margin-bottom: 4px; }
.page .lead { color: var(--text-2); margin-bottom: 24px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.empty { display: grid; justify-items: center; gap: 6px; padding: 48px 24px; text-align: center; color: var(--text-2); }
.empty b { color: var(--text); font-size: 15px; }
.empty-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); margin-bottom: 6px; }
.empty-icon svg { width: 22px; height: 22px; }

.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ───────── Popover / menu ───────── */
.popover {
  position: absolute; z-index: 60; min-width: 220px; padding: 6px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.popover.up { bottom: calc(100% + 6px); left: 8px; right: 8px; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-head b { display: block; }
.menu-head span { font-size: 12px; color: var(--text-2); }
.menu-title { padding: 6px 10px 2px; font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border: 0;
  border-radius: var(--radius-sm); background: transparent; text-align: left;
}
.menu-item:hover { background: var(--surface-3); }
.menu-item svg { width: 16px; height: 16px; color: var(--text-2); }
.menu-item .check { margin-left: auto; color: var(--blue); }
.menu-item.danger { color: var(--bad); }
.menu-item.danger svg { color: var(--bad); }

/* ───────── Toasts ───────── */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--radius);
  background: var(--black); color: #fff; box-shadow: var(--shadow-lg); font-weight: 500;
}
[data-theme="dark"] .toast { background: var(--surface-3); }
.toast button { margin-left: auto; border: 0; background: transparent; color: var(--clarity); font-weight: 650; padding: 4px 6px; }
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45); display: none; }

/* ───────── Tablet e celular: menu lateral vira gaveta ───────── */
@media (max-width: 980px) {
  .app, .app.side-collapsed { grid-template-columns: minmax(0, 1fr); }
  .side, .app.side-collapsed .side {
    position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; visibility: visible; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--shadow-lg);
    padding-top: env(safe-area-inset-top);
  }
  .app.drawer-open .side { transform: none; }
  .app.drawer-open .scrim { display: block; }
  .menu-btn, .app.side-collapsed .menu-btn { display: inline-grid; }
  .collapse-btn { display: none; }
}
@media (max-width: 760px) {
  .content { padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .topbar { padding: 0 8px 0 12px; padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); }
  .input, select, textarea { font-size: 16px; } /* evita o zoom automático no iPhone */
  .btn, .icon-btn, .nav-item, .menu-item { min-height: 40px; }
  .icon-btn { width: 40px; height: 40px; }
  .auth-card { padding: 26px 20px; }
}
