@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Inter:wght@300;400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #F5EDE6;
  --surface:      #FBF7F3;
  --surface-2:    #EDE5DB;
  --text:         #2C2018;
  --text-2:       #7A6455;
  --text-3:       #B5A090;
  --accent:       #3B2D8A;
  --accent-h:     #4E3EAD;
  --accent-s:     #EDE8F8;
  --accent-mid:   rgba(59,45,138,0.12);
  --gold:         #B89A3A;
  --gold-s:       #F8F0DC;
  --success:      #2D6A4F;
  --success-s:    #D8F0E6;
  --warn:         #92400E;
  --warn-s:       #FEF3C7;
  --border:       rgba(44,32,24,0.10);
  --shadow:       0 2px 16px rgba(44,32,24,0.08);
  --shadow-lg:    0 8px 40px rgba(44,32,24,0.14);
  --radius:       16px;
  --radius-sm:    10px;
  --radius-xs:    6px;
  --sidebar:      272px;
  --font-h:       'Playfair Display', Georgia, serif;
  --font-b:       'Inter', system-ui, sans-serif;
}

body {
  font-family: var(--font-b);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── LOGO ── */
.ss-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.ss-icon {
  flex-shrink: 0;
  width: 36px;
  height: 42px;
}
.ss-wordmark { line-height: 1; }
.ss-wordmark strong {
  display: block;
  font-family: var(--font-h);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}
.ss-wordmark .ss-sub {
  display: block;
  font-size: 10px;
  color: var(--text-2);
  font-style: italic;
  font-family: var(--font-h);
}
/* Monograma fallback (admin e telas menores) */
.ss-monogram {
  width: 36px; height: 36px;
  background: var(--text);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-h);
  font-size: 16px;
  font-weight: 600;
  color: var(--bg);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
}
.login-panel.left {
  background: var(--accent);
  color: white;
  position: relative;
  overflow: hidden;
}
.login-panel.left::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  top: -100px; right: -100px;
}
.login-panel.left::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  bottom: -80px; left: -60px;
}
.login-panel.left .ss-monogram {
  width: 52px; height: 52px;
  background: rgba(255,255,255,0.15);
  font-size: 22px;
  margin-bottom: 32px;
}
.login-panel.left h1 {
  font-family: var(--font-h);
  font-size: 42px;
  font-weight: 500;
  line-height: 1.15;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}
.login-panel.left p {
  color: rgba(255,255,255,0.7);
  font-size: 16px;
  position: relative;
  z-index: 1;
  max-width: 340px;
  font-family: var(--font-h);
  font-style: italic;
}
.login-panel.right {
  background: var(--surface);
  align-items: flex-start;
}
.login-form-wrap {
  width: 100%;
  max-width: 380px;
  margin: auto;
}
.login-form-wrap h2 {
  font-family: var(--font-h);
  font-size: 28px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}
.login-form-wrap .sub {
  color: var(--text-2);
  font-size: 14px;
  margin-bottom: 36px;
}
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-group input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 15px;
  transition: border-color 0.2s;
  outline: none;
}
.form-group input:focus { border-color: var(--accent); }
.form-group input::placeholder { color: var(--text-3); }
.form-link {
  text-align: right;
  margin-top: -10px;
  margin-bottom: 20px;
}
.form-link a, .link { color: var(--accent); font-size: 13px; text-decoration: none; }
.form-link a:hover, .link:hover { text-decoration: underline; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-b);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: white;
  width: 100%;
}
.btn-primary:hover { background: var(--accent-h); }
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
}
.btn-secondary:hover { background: var(--border); }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--accent-s); }
.btn-danger { background: #EF4444; color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.form-msg {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  display: none;
}
.form-msg.success { background: var(--success-s); color: var(--success); display: block; }
.form-msg.error { background: #FEE2E2; color: #991B1B; display: block; }

/* ── LAYOUT ── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-user {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-s);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}
.sidebar-user-info strong { display: block; font-size: 13px; font-weight: 500; }
.sidebar-user-info span { font-size: 11px; color: var(--text-2); }

.sidebar-section { padding: 20px 20px 8px; flex: 1; }
.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
  padding: 0 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  color: var(--text);
  margin-bottom: 2px;
  position: relative;
}
.sidebar-item:hover { background: var(--accent-s); }
.sidebar-item.active { background: var(--accent-s); }
.sidebar-item.active .si-num { background: var(--accent); color: white; }
.si-num {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  flex-shrink: 0;
}
.si-info { flex: 1; min-width: 0; }
.si-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.si-date { font-size: 11px; color: var(--text-2); }
.si-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.si-dot.done { background: var(--success); }
.si-dot.partial { background: var(--gold); }
.si-dot.new { background: var(--accent-mid); }

.sidebar-progress {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sp-label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.sp-bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.sp-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.sp-pct { font-size: 11px; color: var(--text-2); margin-top: 4px; text-align: right; }

.sidebar-logout {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logout a {
  font-size: 12px;
  color: var(--text-2);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar-logout a:hover { color: var(--text); }

/* ── MAIN ── */
.main { padding: 48px 56px 80px; max-width: 900px; }

.page-header { margin-bottom: 36px; }
.page-header h1 {
  font-family: var(--font-h);
  font-size: 36px;
  font-weight: 500;
  margin-bottom: 6px;
}
.page-header .subtitle { color: var(--text-2); font-size: 15px; }

/* ── SESSION CARDS ── */
.sessions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  overflow: hidden;
}
.session-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-mid);
}
.sc-stripe {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  border-radius: var(--radius) var(--radius) 0 0;
}
.sc-num {
  font-family: var(--font-h);
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 8px;
  font-style: italic;
}
.sc-title {
  font-family: var(--font-h);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 10px;
}
.sc-date { font-size: 12px; color: var(--text-3); margin-bottom: 16px; }
.sc-progress { }
.sc-prog-bar {
  height: 3px;
  background: var(--surface-2);
  border-radius: 2px;
  margin-bottom: 6px;
  overflow: hidden;
}
.sc-prog-fill { height: 100%; background: var(--accent); border-radius: 2px; }
.sc-prog-info {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
}
.badge-done { background: var(--success-s); color: var(--success); }
.badge-new { background: var(--accent-s); color: var(--accent); }
.badge-partial { background: var(--gold-s); color: var(--gold); }

/* ── SESSION PAGE ── */
.session-breadcrumb {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.session-breadcrumb a { color: var(--accent); text-decoration: none; }
.session-breadcrumb a:hover { text-decoration: underline; }

.session-header { margin-bottom: 32px; }
.session-num {
  font-family: var(--font-h);
  font-style: italic;
  color: var(--accent);
  font-size: 14px;
  margin-bottom: 6px;
}
.session-header h1 {
  font-family: var(--font-h);
  font-size: 34px;
  font-weight: 500;
  line-height: 1.2;
  margin-bottom: 8px;
}
.session-meta {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: var(--text-2);
}

.video-block {
  background: #0D0B16;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/9;
  margin-bottom: 32px;
  position: relative;
}
.video-block iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.video-empty {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.3);
  gap: 12px;
}
.video-empty svg { opacity: 0.4; }

/* ── TABS ── */
.tabs { margin-bottom: 24px; }
.tabs-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-b);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover { color: var(--text); }
.tab-panel { display: none; padding-top: 24px; }
.tab-panel.active { display: block; }

/* ── RESUMO PDF ── */
.pdf-embed-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.pdf-embed-wrap .pdf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.pdf-embed-wrap h3 {
  font-family: var(--font-h);
  font-size: 18px;
  font-weight: 500;
}
.pdf-frame {
  width: 100%;
  height: 600px;
  border: none;
  border-radius: var(--radius-sm);
}
.no-pdf {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-2);
}
.no-pdf svg { margin-bottom: 16px; opacity: 0.3; }

/* ── PLANO DE ACAO ── */
.action-plan { }
.action-intro {
  background: var(--accent-s);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--accent);
}
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin-bottom: 12px;
  display: flex;
  gap: 16px;
  transition: all 0.2s;
}
.task-card.done {
  background: var(--success-s);
  border-color: rgba(45,106,79,0.2);
  opacity: 0.8;
}
.task-check {
  flex-shrink: 0;
  margin-top: 2px;
}
.task-check input[type=checkbox] {
  width: 18px; height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.task-body { flex: 1; }
.task-num { font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.task-title { font-weight: 500; font-size: 15px; margin-bottom: 6px; }
.task-desc { font-size: 13px; color: var(--text-2); margin-bottom: 10px; }
.task-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.task-tag {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}
.tag-when { background: var(--gold-s); color: var(--gold); }
.tag-result { background: var(--accent-s); color: var(--accent); }
.no-plan {
  text-align: center;
  padding: 40px;
  color: var(--text-2);
  font-style: italic;
  font-family: var(--font-h);
}

/* ── DIARIO ── */
.diary-section { }
.diary-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 28px;
}
.diary-form h3 {
  font-family: var(--font-h);
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 6px;
}
.diary-form .sub { font-size: 13px; color: var(--text-2); margin-bottom: 16px; }
.diary-form textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 14.5px;
  line-height: 1.7;
  resize: vertical;
  min-height: 120px;
  outline: none;
  transition: border-color 0.2s;
}
.diary-form textarea:focus { border-color: var(--accent); }
.diary-save { margin-top: 12px; text-align: right; }

.diary-entries h4 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
}
.diary-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin-bottom: 10px;
}
.diary-entry-date { font-size: 11px; color: var(--text-3); margin-bottom: 8px; }
.diary-entry-content { font-size: 14px; white-space: pre-wrap; line-height: 1.7; }
.no-diary { color: var(--text-2); font-size: 13px; font-style: italic; }

/* ── ADMIN ── */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}
.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.admin-card h3 {
  font-family: var(--font-h);
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; font-size: 13px; }
th { font-weight: 600; color: var(--text-2); background: var(--bg); border-bottom: 1px solid var(--border); }
td { border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--accent-s); }

.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.stat-card .num {
  font-family: var(--font-h);
  font-size: 36px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 4px;
}
.stat-card .label { font-size: 13px; color: var(--text-2); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
  outline: none;
}
.form-group textarea:focus { border-color: var(--accent); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.empty { padding: 40px; text-align: center; color: var(--text-2); }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--text);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: #EF4444; }

/* ── MOBILE HEADER ── */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  align-items: center;
  justify-content: space-between;
}
.hamburger { background: none; border: none; cursor: pointer; padding: 4px; }
.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 1px;
  margin: 5px 0;
  transition: all 0.3s;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

/* ── WELCOME CARD ── */
.welcome-card {
  background: linear-gradient(135deg, var(--accent) 0%, #5a4db0 100%);
  border-radius: var(--radius);
  padding: 32px;
  color: white;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
.welcome-card::before {
  content: '';
  position: absolute;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  top: -60px; right: -40px;
}
.welcome-card h2 {
  font-family: var(--font-h);
  font-size: 26px;
  font-weight: 500;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}
.welcome-card p {
  color: rgba(255,255,255,0.75);
  font-size: 14px;
  position: relative;
  z-index: 1;
}
.welcome-stats {
  display: flex;
  gap: 24px;
  margin-top: 20px;
  position: relative;
  z-index: 1;
}
.welcome-stat { }
.welcome-stat .n { font-size: 28px; font-weight: 600; font-family: var(--font-h); }
.welcome-stat .l { font-size: 12px; color: rgba(255,255,255,0.6); }

/* ── RESPONSIVE ── */
@media (max-width: 960px) {
  .login-page { grid-template-columns: 1fr; }
  .login-panel.left { display: none; }
  .login-panel.right { padding: 40px 24px; }

  .mobile-header { display: flex; }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: -300px;
    top: 0;
    width: 280px;
    z-index: 100;
    transition: left 0.3s ease;
    height: 100vh;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay { display: block; }

  .main { padding: 28px 20px 60px; }
  .sessions-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* ── SPINNER ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── UTILS ── */
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.text-muted { color: var(--text-2); }
.text-sm { font-size: 13px; }
.font-h { font-family: var(--font-h); }
.hidden { display: none !important; }
