/* =======================================================================
   Design tokens — minimalista, inspirado em Google Workspace / Apple HIG
   Fonte: pilha de fontes de sistema (a mesma usada nativamente por
   iOS/macOS e pelo Android/Chrome), sem serifas, muito espaço em branco,
   um único tom de azul como acento, superfícies brancas com sombra sutil.
========================================================================== */
:root{
  --bg: #FFFFFF;
  --surface: #F8F9FA;
  --surface-hover: #F1F3F4;
  --border: #DADCE0;
  --text: #202124;
  --text-secondary: #5F6368;
  --primary: #0B57D0;
  --primary-hover: #0A46A6;
  --primary-soft: #E8F0FE;
  --danger: #D93025;
  --danger-soft: #FCE8E6;
  --success: #188038;
  --gold: #E37400;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.06);
  --shadow-2: 0 2px 6px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.08);
}

*{ box-sizing: border-box; }
html, body{ margin:0; padding:0; height:100%; }
body{
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select{ font-family: inherit; font-size: 14px; }
h1,h2,h3{ margin:0; font-weight:600; letter-spacing:-0.01em; }
.hidden{ display:none !important; }

/* ---------- botões / campos genéricos ---------- */
.btn-primary{
  background: var(--primary); color:#fff; border:none; border-radius: var(--radius-sm);
  padding:10px 18px; font-weight:600; cursor:pointer; transition: background .15s ease;
}
.btn-primary:hover{ background: var(--primary-hover); }
.btn-primary:disabled{ opacity:.6; cursor:default; }
.btn-block{ width:100%; }

.btn-secondary{
  background: var(--surface); color: var(--text); border:1px solid var(--border);
  border-radius: var(--radius-sm); padding:8px 14px; font-weight:600; cursor:pointer;
}
.btn-secondary:hover{ background: var(--surface-hover); }

.btn-danger-outline{
  background:#fff; color: var(--danger); border:1px solid var(--danger);
  border-radius: var(--radius-sm); padding:7px 12px; font-weight:600; cursor:pointer; font-size:13px;
}
.btn-danger-outline:hover{ background: var(--danger-soft); }

.link-btn{ background:none; border:none; color: var(--primary); font-weight:600; cursor:pointer; padding:0; }
.link-btn:hover{ text-decoration: underline; }

.icon-btn{ background:none; border:none; color: var(--text-secondary); cursor:pointer; padding:4px; border-radius:6px; display:flex; }
.icon-btn:hover{ background: var(--surface-hover); }
.icon-btn.danger:hover{ color: var(--danger); background: var(--danger-soft); }

input[type="text"], input[type="password"], input[type="date"], select{
  border:1px solid var(--border); border-radius: var(--radius-sm); padding:9px 12px;
  background:#fff; color: var(--text); width:100%; transition: border-color .15s ease;
}
input:focus, select:focus{ outline:none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.card{
  background:#fff; border:1px solid var(--border); border-radius: var(--radius-lg);
  padding:18px; box-shadow: var(--shadow-1);
}

/* ---------- tela de login ---------- */
.auth-body{
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background: var(--surface);
}
.auth-card{
  width:380px; max-width:92vw; background:#fff; border-radius: var(--radius-lg);
  border:1px solid var(--border); box-shadow: var(--shadow-2); padding:32px 28px;
}
.auth-logo{ display:flex; align-items:center; gap:8px; margin-bottom:28px; }
.logo-mark{ color: var(--primary); font-size:20px; }
.logo-text{ font-weight:700; font-size:15px; }
.auth-title{ font-size:20px; margin-bottom:20px; }
.auth-form{ display:flex; flex-direction:column; gap:16px; }
.field{ display:flex; flex-direction:column; gap:6px; }
.field-label{ font-size:12px; font-weight:600; color: var(--text-secondary); }
.field-hint{ font-size:12px; color: var(--text-secondary); margin:-8px 0 0; }
.form-error{
  font-size:13px; color: var(--danger); background: var(--danger-soft);
  border-radius: var(--radius-sm); padding:8px 10px; margin:0;
}
.auth-switch{ text-align:center; margin-top:20px; font-size:13px; color: var(--text-secondary); }

/* ---------- app shell ---------- */
.app-shell{ display:flex; min-height:100vh; }
.sidebar{
  width:232px; flex:none; background: var(--surface); border-right:1px solid var(--border);
  display:flex; flex-direction:column; padding:18px 12px;
}
.sidebar-logo{ display:flex; align-items:center; gap:8px; padding:6px 10px 20px; }
.sidebar-nav{ display:flex; flex-direction:column; gap:2px; flex:1; }
.nav-item{
  display:flex; align-items:center; gap:12px; background:none; border:none; text-align:left;
  padding:10px 12px; border-radius: 999px; color: var(--text); font-weight:500; cursor:pointer;
  width:100%;
}
.nav-item:hover{ background: var(--surface-hover); }
.nav-item.active{ background: var(--primary-soft); color: var(--primary-hover); font-weight:700; }
.nav-icon{ width:18px; height:18px; flex:none; display:inline-flex; align-items:center; justify-content:center; }
.nav-icon svg{ width:18px; height:18px; }
.badge{
  margin-left:auto; background: var(--danger); color:#fff; font-size:10px; font-weight:700;
  border-radius:999px; padding:1px 7px;
}
.sidebar-footer{
  display:flex; align-items:center; justify-content:space-between; padding:10px 12px;
  border-top:1px solid var(--border); margin-top:8px; font-size:13px;
}
.username-label{ color: var(--text-secondary); font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.main-area{ flex:1; display:flex; flex-direction:column; min-width:0; }
.topbar{ padding:22px 32px 8px; }
.topbar h1{ font-size:22px; }
.content{ padding:20px 32px 40px; flex:1; overflow-y:auto; }

/* ---------- grids reutilizáveis ---------- */
.grid-3{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.grid-auto{ display:grid; grid-template-columns:repeat(auto-fill, minmax(260px,1fr)); gap:16px; }
.grid-7{ display:grid; grid-template-columns:repeat(7,1fr); gap:10px; }
@media (max-width: 900px){
  .grid-3{ grid-template-columns:1fr; }
  .grid-7{ grid-template-columns:repeat(4,1fr); }
  .sidebar{ width:80px; }
  .logo-text, .nav-item span:not(.badge), .username-label{ display:none; }
  .nav-item{ justify-content:center; }
}

.stat-label{ font-size:12px; color: var(--text-secondary); font-weight:600; text-transform:uppercase; letter-spacing:.02em; }
.stat-value{ font-size:28px; font-weight:700; margin-top:6px; }
.progress-track{ width:100%; height:8px; background: var(--surface-hover); border-radius:999px; margin-top:10px; overflow:hidden; }
.progress-fill{ height:100%; background: var(--primary); border-radius:999px; transition:width .3s ease; }

.pill-row{ display:flex; gap:8px; margin-top:12px; flex-wrap:wrap; }
.pill-btn{
  background: var(--primary-soft); color: var(--primary-hover); border:none; border-radius:999px;
  padding:7px 14px; font-weight:700; font-size:12px; cursor:pointer;
}
.pill-btn:hover{ background:#D3E3FD; }

.heatmap-row{ display:flex; gap:6px; margin-top:10px; }
.heatmap-cell{ display:flex; flex-direction:column; align-items:center; gap:4px; width:26px; }
.heatmap-square{ width:20px; height:20px; border-radius:5px; }
.heatmap-day{ font-size:9px; color: var(--text-secondary); }

/* ---------- cronograma ---------- */
.day-col{ background:#fff; border:1px solid var(--border); border-radius: var(--radius-md); overflow:hidden; }
.day-head{ text-align:center; padding:8px; font-weight:700; font-size:12px; color: var(--primary); background: var(--primary-soft); }
.day-body{ padding:8px; display:flex; flex-direction:column; gap:6px; min-height:70px; }
.block-chip{
  background: var(--surface); border-radius:6px; padding:6px 8px; font-size:12px;
  display:flex; align-items:center; justify-content:space-between; gap:4px;
}
.block-chip button{ background:none; border:none; color: var(--text-secondary); cursor:pointer; }
.day-input{ margin:0 8px 8px; width:calc(100% - 16px); font-size:12px; padding:6px 8px; }

/* ---------- matérias ---------- */
.subject-card h3{ font-size:15px; }
.subject-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.topic-row{ display:flex; align-items:center; justify-content:space-between; gap:6px; margin-bottom:6px; }
.topic-check{
  width:17px; height:17px; border-radius:5px; border:1.5px solid var(--border); flex:none;
  display:flex; align-items:center; justify-content:center; background:#fff;
}
.topic-check.done{ background: var(--success); border-color: var(--success); }
.topic-label{ display:flex; align-items:center; gap:9px; background:none; border:none; text-align:left; flex:1; cursor:pointer; color: var(--text); font-size:13px; }
.topic-label.done{ color: var(--text-secondary); text-decoration: line-through; }

/* ---------- formulários inline ---------- */
.inline-form{
  display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:16px;
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius-md); padding:12px;
}
.inline-form input, .inline-form select{ flex:1 1 160px; }

/* ---------- flashcards ---------- */
.flash-card{
  background: var(--primary-soft); border:2px dashed #AECBFA; border-radius: var(--radius-lg);
  min-height:170px; display:flex; align-items:center; justify-content:center; text-align:center;
  padding:28px; cursor:pointer;
}
.flash-sub{ font-size:11px; color: var(--primary-hover); font-weight:700; letter-spacing:.05em; margin-bottom:10px; text-transform:uppercase; }
.flash-term{ font-size:20px; font-weight:700; }
.flash-hint{ font-size:12px; color: var(--text-secondary); margin-top:12px; }
.rate-row{ display:flex; gap:8px; margin-top:16px; }
.rate-row button{ flex:1; padding:11px; font-weight:700; color:#fff; border:none; border-radius: var(--radius-sm); cursor:pointer; }
.rate-dificil{ background: var(--danger); }
.rate-bom{ background: #F9AB00; color:#202124 !important; }
.rate-facil{ background: var(--success); }

.list-row{
  display:flex; align-items:center; justify-content:space-between; background:#fff;
  border:1px solid var(--border); border-radius: var(--radius-sm); padding:10px 14px; margin-bottom:8px;
}

/* ---------- provas ---------- */
.exam-card{ background:#fff; border:1px solid var(--border); border-radius: var(--radius-lg); padding:16px; }
.exam-date{ font-size:12px; color: var(--text-secondary); margin-top:2px; }
.exam-days{ font-weight:700; font-size:22px; margin-top:10px; }
.tag-done{
  display:inline-block; margin-top:10px; font-size:11px; font-weight:700; color: var(--success);
  background:#E6F4EA; border-radius:999px; padding:4px 10px;
}

.empty-state{ color: var(--text-secondary); font-size:13px; text-align:center; padding:24px; }
.loading{ color: var(--text-secondary); font-size:13px; padding:24px; text-align:center; }
