/* ==========================================================================
   Plataforma PT — Sistema de diseño compartido
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;1,9..144,300;1,9..144,400&family=Geist+Mono:wght@400;500&family=Geist:wght@300;400;500;600;700&display=swap');

:root {
  --paper:        #F5F1E8;
  --paper-2:      #ECE6D6;
  --paper-3:      #E2DAC4;
  --white:        #FFFFFF;
  --ink:          #1A1A1A;
  --ink-soft:     #4A4744;
  --muted:        #8A8580;
  --line:         #E5DFD2;
  --line-2:       #D9D2C4;
  --shadow:       0 1px 2px rgba(26,26,26,0.04), 0 4px 16px rgba(26,26,26,0.04);
  --shadow-lg:    0 4px 12px rgba(26,26,26,0.06), 0 16px 40px rgba(26,26,26,0.08);

  --accent:       #C8102E;     /* PT red */
  --accent-soft:  #E04657;
  --accent-dark:  #9F0E25;
  --accent-bg:    #FBE7EA;     /* very light red tint */
  --gold:         #F5C518;     /* PT gold */
  --gold-dark:    #C99E0E;

  --green:        #5A7A4A;
  --green-bg:     #E8EFE2;
  --blue:         #486A7A;
  --blue-bg:      #E2EAEE;
  --purple:       #6E5C8E;
  --purple-bg:    #ECE6F2;
  --danger:       #8B2C20;

  --sidebar-bg:   #15171F;
  --sidebar-bg-2: #1F222C;
  --sidebar-line: #2A2D38;
  --sidebar-text: #A8ADBA;
  --sidebar-active-bg: rgba(200,16,46,0.12);

  --radius:       6px;
  --radius-lg:    10px;
}

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

html, body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Geist', -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(26,26,26,0.022) 1px, transparent 0);
  background-size: 4px 4px;
  pointer-events: none; z-index: 0;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ==================== APP SHELL ==================== */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: sticky;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 22px 0 18px;
  display: flex;
  flex-direction: column;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--sidebar-line); border-radius: 2px; }

.sb-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 0 22px 22px;
  border-bottom: 1px solid var(--sidebar-line);
  margin-bottom: 12px;
}
.sb-brand .mark {
  width: 38px; height: 38px;
  background: #fff;
  background-image: url('https://static.wixstatic.com/media/026a2a_5b40509a643344f8b80b65c1ace251d6~mv2.png/v1/fill/w_1100,h_1100,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/pt%20logo.png');
  background-size: 78% 78%;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 0 0 2px rgba(245,197,24,0.35), 0 2px 8px rgba(0,0,0,0.25);
}
.sb-brand .mark::before {
  content: none;
}
.sb-brand h1 {
  font-family: 'Fraunces', serif;
  font-weight: 300;
  font-size: 18px;
  color: #fff;
  font-style: italic;
  letter-spacing: -0.01em;
  line-height: 1;
}
.sb-brand h1 .accent {
  font-style: normal;
  color: var(--gold);
  font-weight: 500;
}
.sb-brand h1 + small {
  display: block;
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sidebar-text);
  margin-top: 4px;
}

.sb-section-label {
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #5A6072;
  padding: 14px 22px 8px;
}

.nav { display: flex; flex-direction: column; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 22px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  position: relative;
  transition: color 0.18s, background 0.18s;
  cursor: pointer;
}
.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.03);
}
.nav-item .nv-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.nav-item .nv-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.nav-item.active {
  color: #fff;
  background: var(--sidebar-active-bg);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
}
.nav-item .badge {
  margin-left: auto;
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  background: var(--accent);
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.sb-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--sidebar-line);
}
.sb-footer .nav-item { font-size: 12.5px; }

/* ==================== TOP BAR ==================== */
.main-area { display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 14px 32px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 5;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  max-width: 420px;
  transition: border-color 0.15s;
}
.search-box:focus-within { border-color: var(--ink-soft); }
.search-box .si {
  width: 14px; height: 14px;
  color: var(--muted);
  flex-shrink: 0;
}
.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--ink);
}
.search-box input::placeholder { color: var(--muted); }

.tb-actions {
  display: flex; align-items: center; gap: 6px;
}
.tb-icon-btn {
  width: 36px; height: 36px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft);
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.tb-icon-btn:hover { background: var(--paper); color: var(--ink); }
.tb-icon-btn .ind {
  position: absolute;
  top: 8px; right: 9px;
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  border: 1.5px solid #fff;
}
.tb-icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; }

.tb-divider {
  width: 1px; height: 22px;
  background: var(--line);
  margin: 0 8px;
}

.tb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 4px 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.tb-user:hover { background: var(--paper); }
.tb-user .who { text-align: right; line-height: 1.2; }
.tb-user .who .name {
  font-weight: 500;
  font-size: 13.5px;
  color: var(--ink);
}
.tb-user .who .role {
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 16px;
  flex-shrink: 0;
  position: relative;
  text-transform: uppercase;
}
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }
.avatar.xl { width: 80px; height: 80px; font-size: 30px; }
.avatar.online::after {
  content: "";
  position: absolute;
  bottom: 1px; right: 1px;
  width: 9px; height: 9px;
  background: var(--green);
  border-radius: 50%;
  border: 2px solid #fff;
}

/* ==================== CONTENT ==================== */
.content {
  padding: 28px 32px 60px;
  flex: 1;
  min-width: 0;
}
.content-wide { max-width: 100%; }
.content-narrow { max-width: 920px; margin: 0 auto; }

.page-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 14px;
}
.page-head h1 {
  font-family: 'Fraunces', serif;
  font-weight: 300;
  font-size: 36px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.page-head h1 .em {
  font-style: italic;
  color: var(--accent);
}
.page-head .crumbs {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.page-head .crumbs a:hover { color: var(--ink-soft); }
.page-head .crumbs .sep { margin: 0 8px; opacity: 0.5; }

/* ==================== COMPONENTS ==================== */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card.no-pad { padding: 0; overflow: hidden; }

.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 {
  font-family: 'Fraunces', serif;
  font-weight: 300;
  font-style: italic;
  font-size: 18px;
  color: var(--ink);
}
.card-head .meta {
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border: 1px solid var(--line-2);
  color: var(--ink);
  padding: 9px 16px;
  border-radius: 4px;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  transition: all 0.15s;
}
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.btn-primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-accent:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost {
  border-color: transparent;
  color: var(--ink-soft);
  background: none;
}
.btn-ghost:hover:not(:disabled) { color: var(--ink); border-color: var(--line); background: var(--paper); }
.btn-sm { padding: 6px 12px; font-size: 9px; }
.btn-lg { padding: 12px 22px; font-size: 11px; }
.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.6; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink-soft);
}
.tag.accent { background: var(--accent-bg); color: var(--accent-dark); }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.gold { background: rgba(245,197,24,0.18); color: var(--gold-dark); }
.tag.blue { background: var(--blue-bg); color: var(--blue); }
.tag.purple { background: var(--purple-bg); color: var(--purple); }

/* Mono labels */
.mono {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.mono-sm { font-size: 9px; }
.mono.muted { color: var(--muted); }

/* Form fields */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--ink-soft); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); font-style: italic; }
.field textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

/* ==================== EMPTY STATES ==================== */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.empty-illus {
  width: 120px; height: 120px;
  margin: 0 auto 16px;
  opacity: 0.6;
}
.empty p {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 15px;
  line-height: 1.5;
}

/* ==================== MODAL ==================== */
.overlay {
  position: fixed; inset: 0;
  background: rgba(26,26,26,0.55);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: stretch;
  justify-content: center;
}
.overlay.active { display: flex; }
.modal {
  width: 100%;
  max-width: 720px;
  background: var(--white);
  margin: 32px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-height: calc(100vh - 64px);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}
.modal-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  font-size: 16px;
}
.modal-close:hover { background: var(--ink); color: var(--paper); }
.modal-body { overflow-y: auto; padding: 24px; }

/* ==================== HOME (LOBBY) GRID ==================== */
.lobby-grid {
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  gap: 22px;
  align-items: start;
}

.lobby-grid > .col { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

/* ==================== AULA TILES ==================== */
.aula-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}
.aula-tile {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px 24px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.aula-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--ink-soft);
}
.aula-tile .tile-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.aula-tile .tile-icon svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.aula-tile.t-red .tile-icon { background: var(--accent-bg); color: var(--accent); }
.aula-tile.t-gold .tile-icon { background: rgba(245,197,24,0.18); color: var(--gold-dark); }
.aula-tile.t-blue .tile-icon { background: var(--blue-bg); color: var(--blue); }
.aula-tile.t-green .tile-icon { background: var(--green-bg); color: var(--green); }
.aula-tile.t-purple .tile-icon { background: var(--purple-bg); color: var(--purple); }
.aula-tile h3 {
  font-family: 'Fraunces', serif;
  font-weight: 300;
  font-style: italic;
  font-size: 24px;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.aula-tile p {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.aula-tile .tile-meta {
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between;
}
.aula-tile .tile-arrow {
  position: absolute;
  top: 24px; right: 24px;
  color: var(--muted);
  font-family: 'Geist Mono', monospace;
  font-size: 14px;
  transition: transform 0.2s, color 0.2s;
}
.aula-tile:hover .tile-arrow { color: var(--accent); transform: translateX(4px); }

/* ==================== LIST ITEMS ==================== */
.list-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  margin-bottom: 8px;
  transition: all 0.15s;
  cursor: pointer;
}
.list-item:hover { border-color: var(--ink-soft); transform: translateX(2px); }
.list-item .li-title {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 300;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 4px;
}
.list-item .li-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  align-items: center;
}
.list-item .li-meta .dot { color: var(--line-2); }

/* ==================== STAT WIDGETS ==================== */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-card .sc-label {
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
}
.stat-card .sc-num {
  font-family: 'Fraunces', serif;
  font-size: 32px;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1;
}
.stat-card .sc-extra {
  font-size: 11px;
  color: var(--ink-soft);
}

/* ==================== TABS ==================== */
.tabs-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 10px 16px;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--ink-soft); }
.tab-btn.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-btn .count {
  margin-left: 6px;
  background: var(--paper);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 9px;
}
.tab-btn.active .count { background: var(--accent-bg); color: var(--accent); }

/* ==================== CALENDAR / MISC ==================== */
.cal-card {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.cal-card::before {
  content: "★";
  position: absolute;
  top: -10px; right: -10px;
  font-size: 80px;
  color: var(--gold);
  opacity: 0.18;
}
.cal-card .cal-day {
  font-family: 'Fraunces', serif;
  font-weight: 300;
  font-size: 64px;
  letter-spacing: -0.04em;
  line-height: 1;
}
.cal-card .cal-weekday {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 22px;
  margin-top: 4px;
}
.cal-card .cal-month {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-top: 6px;
}
.cal-card .cal-add {
  position: absolute;
  right: 18px; bottom: 18px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s;
}
.cal-card .cal-add:hover { transform: scale(1.06); }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1100px) {
  .lobby-grid { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; transform: translateX(-100%); transition: transform 0.25s; z-index: 50; width: 240px; box-shadow: 0 10px 40px rgba(0,0,0,0.3); }
  .shell.menu-open .sidebar { transform: translateX(0); }
  .topbar { padding: 12px 16px; gap: 10px; grid-template-columns: auto 1fr auto; }
  .search-box { display: none; }
  .content { padding: 22px 16px 60px; }
  .page-head h1 { font-size: 28px; }
  .menu-btn { display: flex !important; }
  .tb-divider, .tb-user .who { display: none; }
}
.menu-btn {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  color: var(--ink);
  border-radius: 4px;
}
.menu-btn:hover { background: var(--paper); }

/* ==================== UTILS ==================== */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--muted); }
.text-soft { color: var(--ink-soft); }
.serif {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 300;
}
