/* ==========================================================================
   Portal Terramundi — estilos (sem build, CSS puro)
   Paleta: fundo #585858 · texto #fff · destaque #4195aa · evolveo #8fe800
   ========================================================================== */

:root {
  --base: #585858;
  --base-dark: #4a4a4a;
  --surface: #636363;
  --surface-2: #5f5f5f;
  --accent: #4195aa;
  --accent-hover: #4fa9c0;
  --evolveo: #8fe800;
  --white: #ffffff;
  --muted: rgba(255, 255, 255, 0.6);
  --muted-2: rgba(255, 255, 255, 0.4);
  --border: rgba(255, 255, 255, 0.1);
  --radius: 16px;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.25);
  --shadow-soft: 0 2px 10px rgba(0, 0, 0, 0.18);
  --sidebar-w: 288px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--base);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0; font-weight: 700; }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 999px; }

/* ---------- Utilidades ---------- */
.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.text-evolveo { color: var(--evolveo); }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fade-in { animation: fadeIn .35s ease-out; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.2); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.card-pad { padding: 20px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px; padding: 10px 16px;
  font: inherit; font-weight: 500; cursor: pointer;
  transition: all .2s ease; text-align: center;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-accent { background: var(--accent); color: #fff; box-shadow: var(--shadow-soft); }
.btn-accent:hover:not(:disabled) { background: var(--accent-hover); }
.btn-ghost { background: rgba(255,255,255,.06); color: #fff; }
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,.12); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn.on { color: var(--evolveo); }

/* ---------- Inputs ---------- */
.input, textarea.input, select.input {
  width: 100%; font: inherit; color: #fff;
  background: rgba(74,74,74,.7);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; outline: none; transition: border .2s, box-shadow .2s;
}
.input::placeholder { color: var(--muted-2); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(65,149,170,.3); }
textarea.input { resize: vertical; min-height: 90px; }
select.input { appearance: none; }
label.field-label { display: block; font-size: 14px; font-weight: 500; color: rgba(255,255,255,.8); margin-bottom: 6px; }

/* ==========================================================================
   Layout: sidebar + main + footer
   ========================================================================== */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--base-dark);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; height: 100%;
}
.sidebar-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; border-bottom: 1px solid var(--border);
}
.sidebar-head img { height: 40px; width: auto; max-width: 210px; object-fit: contain; }
.sidebar-search { padding: 12px 12px 8px; position: relative; }
.sidebar-search .icon { position: absolute; left: 22px; top: 50%; transform: translateY(-30%); color: var(--muted-2); }
.sidebar-search input {
  width: 100%; font: inherit; color: #fff;
  background: rgba(88,88,88,.7); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px 8px 34px; outline: none;
}
.sidebar-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(65,149,170,.25); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 12px 16px; }
.sidebar-foot { border-top: 1px solid var(--border); padding: 12px; }
.sidebar-foot .u-nome { font-size: 14px; font-weight: 500; }
.sidebar-foot .u-mail { font-size: 12px; color: var(--muted); }

.main-col { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: none; align-items: center; gap: 12px;
  background: var(--base-dark); border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}
.topbar img { height: 32px; width: auto; max-width: 160px; object-fit: contain; }
.topbar .menu-btn { background: none; border: none; color: #fff; cursor: pointer; padding: 4px; }
.content { flex: 1; overflow-y: auto; }

.footer {
  background: var(--base-dark); border-top: 1px solid var(--border);
  padding: 12px 16px; text-align: center;
}
.footer .inner { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.footer img { height: 20px; width: 20px; border-radius: 5px; }

/* ---------- Nav / acordeões ---------- */
.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px; color: rgba(255,255,255,.8);
  transition: background .15s, color .15s; cursor: pointer;
}
.nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-link.active { background: rgba(65,149,170,.2); color: var(--accent); font-weight: 500; }
.nav-link .icon { color: var(--accent); }
.nav-link.home { margin-bottom: 4px; }

.acc { }
.acc-btn {
  width: 100%; display: flex; align-items: center; gap: 8px;
  background: none; border: none; color: #fff; font: inherit;
  text-align: left; padding: 8px 12px; border-radius: 10px; cursor: pointer;
  transition: background .15s;
}
.acc-btn:hover { background: rgba(255,255,255,.05); }
.acc-btn .icon-cat { color: var(--accent); }
.acc-btn .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-btn .chev { color: var(--muted); transition: transform .2s; }
.acc-btn[aria-expanded="true"] .chev { transform: rotate(90deg); }
.acc-btn.lvl0 { font-weight: 600; }
.acc-btn.lvl1 { font-size: 14px; font-weight: 500; color: rgba(255,255,255,.85); }
.acc-body { margin-left: 10px; padding-left: 8px; border-left: 1px solid var(--border); margin-top: 2px; display: none; }
.acc-body.open { display: block; animation: fadeIn .2s ease-out; }

.panel-item { display: flex; align-items: center; }
.panel-item .plink {
  flex: 1; display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 8px; font-size: 14px; color: rgba(255,255,255,.72);
  transition: background .15s, color .15s;
}
.panel-item .plink:hover { background: rgba(255,255,255,.05); color: #fff; }
.panel-item .plink.active { background: rgba(65,149,170,.2); color: var(--accent); font-weight: 500; }
.panel-item .plink .icon { opacity: .7; }
.panel-item .plink .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-btn {
  background: none; border: none; cursor: pointer; padding: 6px; border-radius: 6px;
  color: var(--muted-2); transition: color .15s;
}
.fav-btn:hover { color: rgba(255,255,255,.8); }
.fav-btn.on { color: var(--evolveo); }
.nav-section-label { padding: 6px 12px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-2); }

/* ---------- Drawer mobile ---------- */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 50; display: none;
}
.drawer-overlay.open { display: block; }
.drawer-overlay .backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(2px); animation: fadeIn .2s; }
.drawer-overlay .drawer {
  position: absolute; left: 0; top: 0; height: 100%; width: var(--sidebar-w); max-width: 85vw;
  box-shadow: var(--shadow-card);
}
.drawer-close { position: absolute; right: 8px; top: 8px; z-index: 10; background: none; border: none; color: rgba(255,255,255,.7); cursor: pointer; padding: 8px; }

/* ==========================================================================
   Login
   ========================================================================== */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 16px; }
.login-box { width: 100%; max-width: 420px; }
.login-logo { display: flex; justify-content: center; margin-bottom: 28px; }
.login-logo img { width: 260px; max-width: 80%; height: auto; object-fit: contain; }
.login-foot { margin-top: 24px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; color: var(--muted-2); }
.login-foot img { height: 20px; width: 20px; border-radius: 5px; }
.pw-wrap { position: relative; }
.pw-wrap .toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; padding: 2px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: rgba(255,255,255,.75); cursor: pointer; user-select: none; }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.alert-error { background: rgba(220,60,60,.15); border: 1px solid rgba(220,60,60,.35); color: #ffd7d7; padding: 10px 14px; border-radius: 10px; font-size: 14px; }

/* ==========================================================================
   Página do painel
   ========================================================================== */
.page { padding: 20px; max-width: 1000px; margin: 0 auto; }
.page-wide { max-width: 1152px; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 12px; color: var(--muted-2); }
.breadcrumb .icon { width: 13px; height: 13px; }
.breadcrumb .cur { color: rgba(255,255,255,.8); }
.stack { display: flex; flex-direction: column; gap: 20px; }

.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-head h1 { font-size: 22px; }
.panel-head .tag { margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.panel-actions { display: flex; gap: 8px; flex-shrink: 0; }

.iframe-box { position: relative; width: 100%; height: min(75vh, 620px); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.iframe-box iframe { width: 100%; height: 100%; border: 0; }
.iframe-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: var(--surface); text-align: center; padding: 24px; }

.section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-weight: 600; }
.section-title .icon { color: var(--accent); }
.section-title .hint { font-size: 12px; color: var(--muted-2); font-weight: 400; }

/* Anotações e tarefas */
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  background: rgba(88,88,88,.4); border: 1px solid rgba(255,255,255,.05);
  border-radius: 12px; padding: 10px 12px;
}
.list-item .meta { margin-top: 4px; font-size: 12px; color: var(--muted-2); }
.item-row { display: flex; align-items: flex-start; gap: 10px; }
.item-grow { flex: 1; min-width: 0; }
.item-text { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.icon-btn { background: none; border: none; cursor: pointer; padding: 4px; color: var(--muted-2); transition: color .15s; border-radius: 6px; }
.icon-btn:hover { color: #ff8a8a; }
.row-actions { display: flex; gap: 4px; }

.checkbox-task {
  margin-top: 2px; width: 20px; height: 20px; flex-shrink: 0; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.3); background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #fff; transition: all .15s;
}
.checkbox-task.done { background: var(--accent); border-color: var(--accent); }
.task-desc { font-size: 14px; }
.task-desc.done { color: var(--muted-2); text-decoration: line-through; }
a.task-desc { display: inline-block; cursor: pointer; transition: color .15s; }
a.task-desc:hover { color: var(--accent); }
a.task-desc.done:hover { color: var(--muted); }
.task-tags { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; }
.task-tags .late { color: #ff8a8a; }
.task-tags .tag-link { color: var(--accent); display: inline-flex; align-items: center; gap: 4px; }
.task-tags .tag-plain { color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }

.form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.form-row .input { flex: 1; min-width: 140px; }
.form-inline-date { width: 170px; }

/* ==========================================================================
   Home
   ========================================================================== */
.welcome h1 { font-size: 22px; }
.welcome .date { margin-top: 4px; font-size: 14px; color: var(--muted); text-transform: capitalize; }
.welcome .resumo { margin-top: 12px; font-size: 14px; color: rgba(255,255,255,.75); }
.welcome .resumo b { color: var(--accent); }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { display: flex; align-items: center; gap: 12px; padding: 16px; }
.stat .ic { width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px; background: rgba(65,149,170,.15); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.stat .lbl { font-size: 12px; color: var(--muted-2); }
.stat .val { font-size: 14px; font-weight: 600; }
.stat .sub { font-size: 12px; color: var(--muted-2); }

.home-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.home-left, .home-right { display: flex; flex-direction: column; gap: 24px; }

.link-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(88,88,88,.4); border: 1px solid rgba(255,255,255,.05);
  border-radius: 12px; padding: 10px 12px; transition: border .15s, background .15s;
}
.link-item:hover { border-color: rgba(65,149,170,.4); background: rgba(88,88,88,.6); }
.link-item .t { font-size: 14px; font-weight: 500; }
.link-item .s { font-size: 12px; color: var(--muted-2); }
.link-item .time { font-size: 12px; color: var(--muted-2); flex-shrink: 0; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.badge { border-radius: 999px; background: rgba(65,149,170,.2); color: var(--accent); font-size: 12px; font-weight: 600; padding: 2px 8px; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week .day { border: 1px solid var(--border); background: rgba(88,88,88,.4); border-radius: 10px; padding: 8px 2px; text-align: center; }
.week .day.today { border-color: var(--accent); background: rgba(65,149,170,.12); }
.week .day .dl { font-size: 10px; text-transform: uppercase; color: var(--muted-2); }
.week .day .dn { font-size: 14px; font-weight: 600; }
.week .day .dc { margin-top: 4px; display: inline-block; border-radius: 999px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; padding: 0 6px; }
.week .day .dc.empty { background: none; color: rgba(255,255,255,.25); }

.empty-msg { font-size: 14px; color: var(--muted-2); }

/* ==========================================================================
   Toasts
   ========================================================================== */
.toast-wrap { position: fixed; bottom: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 12px;
  background: rgba(74,74,74,.96); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-card);
  animation: toastIn .25s ease-out;
}
.toast .icon.success { color: var(--evolveo); }
.toast .icon.error { color: #ff8a8a; }
.toast .icon.info { color: var(--accent); }
.toast span { font-size: 14px; }

/* ==========================================================================
   Responsivo
   ========================================================================== */
@media (max-width: 1023px) {
  .sidebar.desktop { display: none; }
  .topbar { display: flex; }
  .home-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page { padding: 16px; }
  .panel-actions .label { display: none; }
}
