/* Shared chrome: wordmark, skip link, public header/footer, minimal pages, app shell. */
.wordmark { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-18); font-weight: 600; letter-spacing: -0.01em; color: var(--brand-900); text-decoration: none; white-space: nowrap; }
.wordmark:hover { text-decoration: none; color: var(--brand-900); }
.logo-mark { flex-shrink: 0; border-radius: 25%; }
.skip-link { position: absolute; left: var(--s-4); top: -60px; z-index: 100; padding: var(--s-2) var(--s-3); background: var(--ink-900); color: var(--white); border-radius: var(--radius-control); }
.skip-link:focus { top: var(--s-2); }

/* ---------- Public site ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line-100); }
.site-header-inner { display: flex; align-items: center; gap: var(--s-6); height: 64px; }
.site-nav { display: flex; align-items: center; gap: var(--s-1); }
.site-nav a { padding: 6px 10px; border-radius: var(--radius-control); font-size: var(--fs-14); font-weight: 500; color: var(--ink-700); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink-900); text-decoration: none; background: var(--surface-50); }
.site-actions { display: flex; align-items: center; gap: var(--s-2); margin-left: auto; }
.lang-switch { display: inline-flex; margin-right: var(--s-2); font-size: var(--fs-13); font-weight: 500; }
.lang-switch a { padding: 4px 6px; color: var(--ink-500); }
.lang-switch a[aria-current="true"] { color: var(--ink-900); }
.lang-switch a + a { border-left: 1px solid var(--line-200); }
.nav-toggle { display: none; }
@media (max-width: 760px) {
    .site-header-inner { gap: var(--s-3); }
    .site-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; padding: var(--s-2) var(--s-4) var(--s-4); background: var(--white); border-bottom: 1px solid var(--line-200); box-shadow: var(--shadow-pop); }
    .site-nav.is-open { display: flex; }
    .site-nav a { padding: 10px; font-size: var(--fs-16); }
    .nav-toggle { display: inline-flex; }
    .hide-sm { display: none; }
    .lang-switch { margin-right: 0; }
}
@media (max-width: 400px) { .site-actions .btn-primary { padding: 0 var(--s-3); } }

.site-footer { margin-top: var(--s-20); padding: var(--s-10) 0 var(--s-8); border-top: 1px solid var(--line-200); background: var(--surface-50); font-size: var(--fs-14); }
.site-footer-grid { display: grid; gap: var(--s-6); }
@media (min-width: 768px) { .site-footer-grid { grid-template-columns: 1fr 2fr; } }
.footer-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2) var(--s-6); }
@media (min-width: 768px) { .footer-links { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.footer-links a { color: var(--ink-700); }
.site-footer-legal { margin-top: var(--s-8); padding-top: var(--s-4); border-top: 1px solid var(--line-200); font-size: var(--fs-13); color: var(--ink-500); }
.site-footer-legal p { margin: 0 0 var(--s-1); }

/* ---------- Minimal pages (errors, public QR, landing) ---------- */
.layout-minimal { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; background: var(--surface-50); }
.minimal-head { padding: var(--s-5) var(--s-4); text-align: center; }
.minimal-head .wordmark { font-size: var(--fs-16); }
.minimal-main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 0 var(--s-4) var(--s-8); }
.minimal-main.wide { max-width: 960px; }
.minimal-foot { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--s-2); padding: var(--s-5) var(--s-4) var(--s-6); font-size: var(--fs-13); color: var(--ink-500); }
.minimal-foot a { color: var(--ink-500); }
.error-page { margin-top: var(--s-10); padding: var(--s-8) var(--s-6); background: var(--white); border: 1px solid var(--line-200); border-radius: var(--radius-card); text-align: center; }
.error-code { margin: 0 0 var(--s-2); font-family: var(--font-mono); font-size: var(--fs-14); color: var(--ink-500); }
.error-page h1 { font-size: var(--fs-24); }
.error-page pre { text-align: left; }

/* ---------- App shell ---------- */
.layout-app { background: var(--white); }
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.app-sidebar { position: sticky; top: 0; display: flex; flex-direction: column; gap: var(--s-4); width: var(--sidebar-w); height: 100vh; height: 100dvh; padding: var(--s-4); background: var(--surface-50); border-right: 1px solid var(--line-200); overflow-y: auto; flex-shrink: 0; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; height: 36px; padding-left: var(--s-1); }
.sidebar-close { display: none; }
.sidebar-nav { display: flex; flex-direction: column; gap: var(--s-4); }
.sidebar-section { display: flex; flex-direction: column; gap: 2px; }
.sidebar-label { padding: 0 var(--s-2) var(--s-1); font-size: var(--fs-12); font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-500); }
.sidebar-link { display: flex; align-items: center; gap: var(--s-2); width: 100%; min-height: 34px; padding: 6px var(--s-2); border: 0; border-radius: var(--radius-control); background: none; font-size: var(--fs-14); color: var(--ink-700); text-align: left; text-decoration: none; cursor: pointer; }
.sidebar-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-link .count { flex: none; font-size: var(--fs-12); color: var(--ink-500); font-variant-numeric: tabular-nums; }
.sidebar-link .icon { color: var(--ink-500); }
.sidebar-link:hover { background: var(--line-100); color: var(--ink-900); text-decoration: none; }
.sidebar-link.is-active { background: var(--white); color: var(--ink-900); box-shadow: 0 0 0 1px var(--line-200); }
.sidebar-link.is-active .icon { color: var(--brand-700); }
.sidebar-add { color: var(--ink-500); }
.sidebar-plan { margin-top: auto; }
.plan-box { padding: var(--s-3); border: 1px solid var(--line-200); border-radius: var(--radius-card); background: var(--white); font-size: var(--fs-13); }
.plan-box .usage { display: flex; justify-content: space-between; margin: 6px 0 0; color: var(--ink-700); font-variant-numeric: tabular-nums; }
.plan-box .meter { height: 4px; margin-top: 4px; border-radius: 2px; background: var(--line-100); overflow: hidden; }
.plan-box .meter span { display: block; height: 100%; width: var(--w, 0%); background: var(--brand-700); }
.plan-box .meter.full span { background: var(--warning-text); }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-header { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: var(--s-3); height: 60px; padding: 0 var(--s-6); background: rgba(255, 255, 255, .97); border-bottom: 1px solid var(--line-100); }
.sidebar-open { display: none; }
.app-search { position: relative; flex: 1; max-width: 420px; }
.app-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-500); pointer-events: none; }
.app-search .input { padding-left: 34px; background: var(--surface-50); border-color: transparent; }
.app-search .input:focus { background: var(--white); }
.app-header-actions { display: flex; align-items: center; gap: var(--s-1); margin-left: auto; }
.bell { position: relative; }
.avatar-btn { padding: 0 4px; }
.menu-user { display: flex; flex-direction: column; padding: 8px 10px; font-size: var(--fs-14); min-width: 0; }
.app-content { flex: 1; width: 100%; max-width: 1280px; padding: var(--s-6); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-6); }
.page-head h1 { margin: 0; font-size: var(--fs-24); }
.page-head .sub { margin: 6px 0 0; color: var(--ink-700); font-size: var(--fs-14); max-width: 64ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }

@media (max-width: 960px) {
    .app-sidebar { position: fixed; z-index: 75; left: 0; top: 0; transform: translateX(-100%); transition: transform var(--t-med) var(--ease); box-shadow: var(--shadow-pop); }
    .app-sidebar.is-open { transform: none; }
    .sidebar-close, .sidebar-open { display: inline-flex; }
    .app-header { padding: 0 var(--s-4); }
    .app-content { padding: var(--s-4); }
}
@media (max-width: 480px) { .page-head h1 { font-size: var(--fs-20); } }

/* ---------- Login ---------- */
.auth-card { margin-top: var(--s-10); padding: var(--s-8) var(--s-6); background: var(--white); border: 1px solid var(--line-200); border-radius: var(--radius-card); }
.auth-card h1 { font-size: var(--fs-24); }
.auth-card .alert { margin-bottom: var(--s-4); }
.google-btn { margin-top: var(--s-6); gap: var(--s-3); }
.google-btn.is-disabled { pointer-events: none; opacity: .5; }
.auth-card .consent { margin: var(--s-4) 0 0; text-align: center; }
