/* ============================================================
   Layout — app shell, sidebar, topbar, page heads, login,
   detail, account, and the Mural (home) feed
   A∴R∴L∴S∴ Justiça e Liberdade
   ============================================================ */

/* ============== Shell ============== */
.app {
  display: grid;
  grid-template-columns: 252px 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.app[data-collapsed="true"] { grid-template-columns: 64px 1fr; }

/* ============== Sidebar ============== */
.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
  padding: var(--pad-4) 0 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.sidebar-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 8px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.sidebar-scroll::-webkit-scrollbar-thumb:hover { background: var(--ink-soft); }
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--pad-4) var(--pad-4);
  border-bottom: 1px solid var(--line-soft);
}
.brand-mark { width: 36px; height: 36px; flex-shrink: 0; }
.brand-text { font-family: var(--f-display); line-height: 1.1; }
.brand-text .top {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--f-ui);
  font-weight: 500;
  margin-bottom: 3px;
}
.brand-text .name {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  font-style: italic;
}
.brand-text .sub {
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
  margin-top: 1px;
  font-family: var(--f-ui);
}

.nav-section { padding: var(--pad-4) var(--pad-3) var(--pad-2); }
.nav-section-flat { padding-top: var(--pad-3); padding-bottom: 0; }
.nav-section .label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 var(--pad-2);
  margin-bottom: 4px;
}
.nav-section-toggle {
  width: 100%;
  background: transparent;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px var(--pad-2);
  margin-bottom: 4px;
  color: var(--muted);
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.12s, color 0.12s;
}
.nav-section-toggle:hover { background: var(--bg-soft); color: var(--ink-soft); }
.nav-section-toggle .label { margin-bottom: 0; padding: 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px var(--pad-2);
  border-radius: var(--radius);
  color: var(--ink-soft);
  font-size: 13.5px;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--bg-soft); color: var(--ink); }
.nav-item[aria-current="true"] {
  background: var(--bg-soft);
  color: var(--ink);
  box-shadow: inset 2px 0 0 var(--gold);
}
.nav-item .ico { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.sidebar-foot {
  flex-shrink: 0;
  padding: var(--pad-3) var(--pad-3);
  border-top: 1px solid var(--line-soft);
  background: var(--bg-elev);
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius);
  cursor: pointer;
}
.user-chip[aria-current="true"] {
  background: var(--bg-soft);
  box-shadow: inset 2px 0 0 var(--gold);
}
.user-chip[aria-current="true"] .name { color: var(--ink); }
.user-chip:hover { background: var(--bg-soft); }
.user-chip .meta { line-height: 1.2; min-width: 0; flex: 1; }
.user-chip .name { font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .grau { font-size: 10.5px; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; }

/* ============== Main / Topbar ============== */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
  display: flex;
  align-items: center;
  padding: 0 var(--pad-5);
  gap: var(--pad-4);
  position: sticky; top: 0; z-index: 10;
}
.crumb { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); }
.crumb .seg { font-size: 14px; color: var(--muted); font-style: italic; }
.crumb .sep { color: var(--line); }
.crumb .cur { font-size: 20px; color: var(--ink); font-weight: 600; }
.topbar .actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.search { position: relative; flex: 1; max-width: 480px; }
.search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: var(--radius);
  outline: none;
  font-size: 13px;
  transition: border 0.15s;
}
.search input:focus { border-color: var(--ink-soft); }
.search .ico,
.search > svg {
  position: absolute;
  left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.content { padding: var(--pad-5) var(--pad-5) var(--pad-6); min-height: 0; }
.content.tight { padding-top: var(--pad-4); }

/* ============== Page header ============== */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--pad-4);
  margin-bottom: var(--pad-4);
  padding-bottom: var(--pad-3);
  border-bottom: 1px solid var(--line);
}
.page-head h1 {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 32px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.page-head .sub {
  color: var(--ink-soft);
  font-size: 13px;
  font-family: var(--f-display);
  font-style: italic;
}
.page-head .right { display: flex; gap: 8px; align-items: center; }

/* ============== Login ============== */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 480px;
  background: var(--bg);
}
.login-art {
  background: var(--ink);
  color: var(--bg);
  padding: var(--pad-6);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-art .ornament {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0.07;
  pointer-events: none;
}
.login-art .ornament img { width: 70%; height: 70%; object-fit: contain; }
.login-art .quote {
  font-family: var(--f-display);
  font-size: 26px;
  font-style: italic;
  line-height: 1.3;
  max-width: 460px;
  position: relative;
  z-index: 1;
}
.login-art .quote::before {
  content: '"';
  font-size: 64px;
  position: absolute;
  left: -28px;
  top: -16px;
  color: var(--gold);
  font-family: var(--f-display);
  font-style: normal;
}
.login-art .attrib {
  margin-top: 18px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-family: var(--f-ui);
  position: relative; z-index: 1;
}
.login-art .brand-block { display: flex; flex-direction: column; gap: 4px; position: relative; z-index: 1; }
.login-art .lodge {
  font-family: var(--f-display);
  font-size: 30px;
  font-style: italic;
  letter-spacing: -0.01em;
}
.login-art .lodge-sub {
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
}
.login-form {
  background: var(--bg-elev);
  padding: var(--pad-6) var(--pad-5);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-form h1 { font-family: var(--f-display); font-size: 32px; font-weight: 600; margin: 0 0 6px; }
.login-form .lead {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: var(--pad-5);
  font-family: var(--f-display);
  font-style: italic;
}
.login-form .foot {
  margin-top: var(--pad-4);
  padding-top: var(--pad-4);
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.05em;
}

/* ============== Detail page ============== */
.detail { display: grid; grid-template-columns: 240px 1fr 320px; gap: var(--pad-5); }
.detail .cover-block { display: flex; flex-direction: column; gap: var(--pad-3); }
.detail .cover-block .big-cover {
  aspect-ratio: 2/3;
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  position: relative;
  overflow: hidden;
}
.detail .meta-block .title {
  font-family: var(--f-display);
  font-size: 38px;
  font-weight: 600;
  line-height: 1.05;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.detail .meta-block .author {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 18px;
  color: var(--ink-soft);
  margin-bottom: var(--pad-4);
}
.detail .meta-block .description {
  font-size: 14px;
  line-height: 1.65;
  max-width: 64ch;
  color: var(--ink-soft);
  margin: var(--pad-4) 0;
}
.detail .fact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--pad-3);
  margin-top: var(--pad-3);
}
.detail .fact { border-top: 1px solid var(--line); padding-top: 8px; }
.detail .fact .k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 2px; }
.detail .fact .v { font-family: var(--f-display); font-size: 15px; font-weight: 500; color: var(--ink); }
.detail .reserve-block { position: sticky; top: 80px; align-self: start; }

.reserve-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pad-4);
}
.reserve-card h3 { font-family: var(--f-display); font-size: 20px; margin: 0 0 var(--pad-3); font-weight: 600; }
.reserve-card .status-line {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: var(--pad-3);
  padding-bottom: var(--pad-3);
  border-bottom: 1px solid var(--line-soft);
}
.reserve-card .due { font-size: 12px; color: var(--ink-soft); margin-bottom: var(--pad-2); font-family: var(--f-display); font-style: italic; }
.reserve-card .due .d { font-style: normal; color: var(--ink); font-weight: 600; font-family: var(--f-mono); }
.queue-list { margin-top: var(--pad-3); padding-top: var(--pad-3); border-top: 1px solid var(--line-soft); }
.queue-list h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 0 0 8px; font-weight: 500; }
.queue-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 12.5px; }
.queue-item .pos { font-family: var(--f-mono); font-size: 11px; color: var(--muted); width: 18px; }
.queue-item.me { color: var(--ink); font-weight: 500; }
.queue-item.me .pos { color: var(--red); }

/* ============== Account ============== */
.account-grid { display: grid; grid-template-columns: 280px 1fr; gap: var(--pad-5); }
.account-card .head { padding: var(--pad-4); border-bottom: 1px solid var(--line); text-align: center; }
.account-card .head .av {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg-elev);
  display: grid; place-items: center;
  font-family: var(--f-display);
  font-size: 30px;
  font-weight: 600;
  margin: 0 auto var(--pad-3);
}
.account-card .head .n { font-family: var(--f-display); font-size: 20px; font-weight: 600; }
.account-card .body { padding: var(--pad-3) var(--pad-4); }
.account-card .body dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-top: 12px; }
.account-card .body dd { margin: 2px 0 0; font-family: var(--f-display); font-size: 15px; }

.list-section { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); }
.list-section .head {
  padding: 14px var(--pad-4);
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.list-section .head h3 { font-family: var(--f-display); font-size: 18px; margin: 0; font-weight: 600; }

/* ============== Home / Mural ============== */
.home-hello {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--pad-4);
  margin-bottom: var(--pad-4);
  padding-bottom: var(--pad-3);
  border-bottom: 1px solid var(--line);
}
.home-greeting {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 14px;
  color: var(--gold-deep);
  margin-bottom: 4px;
}
.home-title { font-family: var(--f-display); font-weight: 600; font-size: 36px; margin: 0 0 4px; letter-spacing: -0.01em; }
.home-sub { color: var(--ink-soft); font-size: 13.5px; font-family: var(--f-display); font-style: italic; }

.featured-post {
  display: grid;
  grid-template-columns: 320px 1fr;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  overflow: hidden;
  margin-bottom: 28px;
  box-shadow: var(--shadow-pop);
}
.featured-art {
  position: relative;
  background: linear-gradient(160deg, var(--ink) 0%, #07121f 100%);
  min-height: 240px;
  overflow: hidden;
}
.featured-art-bg {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 30% 30%, rgba(184,146,61,0.15), transparent 60%),
                    radial-gradient(circle at 70% 80%, rgba(184,146,61,0.08), transparent 50%);
}
.featured-art-ornaments { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0.15; }
.featured-date-badge {
  position: absolute;
  top: 24px; left: 24px;
  background: var(--bg-elev);
  border: 1px solid var(--gold-soft);
  border-radius: 4px;
  padding: 8px 14px;
  text-align: center;
  min-width: 70px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.featured-date-badge .d { font-family: var(--f-display); font-size: 28px; font-weight: 700; line-height: 1; color: var(--ink); }
.featured-date-badge .m { font-size: 10px; letter-spacing: 0.18em; color: var(--gold-deep); margin-top: 2px; font-weight: 600; }
.featured-body { padding: 28px; display: flex; flex-direction: column; }
.featured-meta { display: flex; gap: 6px; margin-bottom: 12px; }
.featured-title { font-family: var(--f-display); font-weight: 600; font-size: 28px; margin: 0 0 8px; line-height: 1.15; letter-spacing: -0.005em; }
.featured-resumo { font-family: var(--f-display); font-style: italic; font-size: 17px; color: var(--ink-soft); line-height: 1.45; margin: 0 0 16px; }
.featured-event-info {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--ink);
}
.featured-event-info > div { display: flex; align-items: center; gap: 8px; }
.featured-foot {
  margin-top: auto;
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

/* Post grid */
.post-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 4px;
  grid-auto-flow: dense;
  gap: 16px;
  align-items: start;
}
.post-card { grid-row: span var(--row-span, 60); }
@media (max-width: 1100px) { .post-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 800px)  { .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px)  { .post-grid { grid-template-columns: 1fr; } }

.post-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.post-card:hover { border-color: var(--ink-soft); box-shadow: var(--shadow-card); transform: translateY(-1px); }
.post-body { padding: 16px; display: flex; flex-direction: column; flex: 1; position: relative; }
.post-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.post-title { font-family: var(--f-display); font-weight: 600; font-size: 17px; line-height: 1.2; margin: 0 0 6px; text-wrap: balance; }
.post-resumo {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0 0 12px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.post-event-strip {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}
.post-event-date {
  text-align: center;
  background: var(--bg-elev);
  border: 1px solid var(--gold-soft);
  border-radius: 4px;
  padding: 6px 10px;
  min-width: 54px;
}
.post-event-date .d { font-family: var(--f-display); font-size: 22px; font-weight: 700; line-height: 1; color: var(--ink); }
.post-event-date .m { font-size: 9.5px; letter-spacing: 0.15em; color: var(--gold-deep); margin-top: 2px; font-weight: 600; }
.post-event-info { font-size: 12px; color: var(--ink-soft); display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.post-event-info > div { display: flex; align-items: center; gap: 6px; }
.post-event-local { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-attachment {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  margin-bottom: 10px;
  font-size: 12px;
}
.post-attachment .name { font-family: var(--f-mono); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-attachment .size { color: var(--muted); font-size: 11px; }
.post-foot {
  margin-top: auto;
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 10px;
  border-top: 1px dashed var(--line-soft);
  font-size: 11.5px; color: var(--muted);
}
.post-author { display: flex; align-items: center; gap: 6px; }
.post-date { font-family: var(--f-mono); font-size: 11px; }
.post-gallery-preview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 2px;
  aspect-ratio: 4/3;
  background: var(--ink);
  position: relative;
}
.post-photo-placeholder { background: linear-gradient(135deg, #3d6e8c, #1a3a52); display: grid; place-items: center; position: relative; overflow: hidden; }
.post-photo-placeholder:nth-child(2) { background: linear-gradient(135deg, #6e3d52, #3a1a2a); }
.post-photo-placeholder:nth-child(3) { background: linear-gradient(135deg, #3d6e3d, #1a3a1a); }
.post-photo-placeholder:nth-child(4) { background: linear-gradient(135deg, #6e5a3d, #3a2a1a); }
.post-photo-more {
  position: absolute;
  bottom: 8px; right: 8px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--f-mono);
}

/* ============== Responsive ============== */
@media (max-width: 800px) {
  .featured-post { grid-template-columns: 1fr; }
  .featured-art { min-height: 160px; }
}
@media (max-width: 1100px) {
  .detail { grid-template-columns: 200px 1fr; }
  .detail .reserve-block { grid-column: 1 / -1; position: static; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .detail { grid-template-columns: 1fr; }
}
