/* The Penguin Group Client Portal - shared styles (from the TPG design system) */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #0B0B0C; --ink-soft: #22242A; --amber: #FBAF2A; --amber-deep: #E89A1A; --cream: #FDF4E7;
  --red: #EE2C3C; --lavender: #ECEEFB; --pink: #FCEBEC; --mint: #E7F6EE; --butter: #FDEFC8;
  --g50: #F7F7F5; --g100: #EFEFEC; --g200: #E2E2DD; --g300: #C9C9C2; --g400: #A0A099; --g500: #71716B; --g600: #52524C; --g700: #383833;
  --display: 'Poppins', 'Segoe UI', system-ui, sans-serif;
  --body: 'Inter', 'Segoe UI', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--body); color: var(--g700); background: #fff; }
a { color: var(--ink); }
a:hover { color: var(--g600); }
h1, h2, h3 { font-family: var(--display); color: var(--ink); margin: 0; }
.dot { color: var(--amber); }
button { font: inherit; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(251,175,42,0.55); border-radius: 8px; }
[hidden] { display: none !important; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; border: 1px solid transparent; }
.btn-amber { background: var(--amber); color: var(--ink); }
.btn-amber:hover { background: var(--amber-deep); color: var(--ink); }
.btn-ink { background: var(--ink); color: #fff; min-height: 44px; padding: 0 22px; }
.btn-ink:hover { background: var(--ink-soft); color: #fff; }
.btn-outline { border-color: var(--ink); background: #fff; color: var(--ink); }
.btn[aria-disabled="true"], .btn:disabled { opacity: .45; pointer-events: none; }

/* Avatar */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--amber); display: inline-flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 600; font-size: 13px; flex: none; }

/* App shell with sidebar */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.sidebar { flex: 1 1 280px; max-width: 100%; background: var(--g50); border-right: 1px solid var(--g200); padding: 20px 16px; display: flex; flex-direction: column; gap: 20px; }
.sidebar .logo { padding: 0 8px; display: flex; align-items: center; justify-content: space-between; }
.sidebar .logo img { height: 32px; display: block; }
.sidebar .signout { font-size: 13px; font-weight: 500; color: var(--g600); }
.sections { display: flex; gap: 8px; padding: 0 4px; }
.sections a { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--ink); text-decoration: none; }
.sections a:hover { background: var(--g100); }
.sections a[aria-current="page"] { box-shadow: inset 0 0 0 1.5px var(--ink); }
.group-label { padding: 0 12px 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--g500); }
.navlist { display: flex; flex-direction: column; gap: 2px; }
.navitem { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; font-size: 14px; text-align: left; cursor: pointer; background: transparent; color: var(--g700); text-decoration: none; }
.navitem:hover { background: var(--g100); }
.navitem.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(11,11,12,0.08); }
.navitem .ellipsis { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 32px; border-bottom: 1px solid var(--g200); }
.crumbs { display: none !important; }
.crumbs strong { color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; min-height: 40px; border: 1px solid var(--g200); border-radius: 10px; background: #fff; }
.search input { flex: 1; border: 0; outline: 0; font: inherit; font-size: 14px; background: transparent; color: var(--ink); min-width: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--g500); }
.empty { padding: 24px; text-align: center; color: var(--g500); font-size: 14px; }
.loading { padding: 64px; text-align: center; color: var(--g500); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-size: 14px; box-shadow: 0 18px 48px rgba(11,11,12,0.2); z-index: 100; }

.bar { height: 8px; background: var(--g100); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--amber); border-radius: 4px; }

/* Admin: client switcher next to the logo (custom menu that always opens downward) */
.client-switch { position: relative; flex: 1 1 auto; min-width: 0; max-width: 210px; }
.cs-btn { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 0 12px; border: 1px solid var(--g200); border-radius: 999px; background: #fff; font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; }
.cs-btn:hover, .cs-btn[aria-expanded="true"] { border-color: var(--g400); background: var(--g50); }
.cs-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-chev { flex: none; width: 6px; height: 6px; margin-top: -3px; border-right: 2px solid var(--g500); border-bottom: 2px solid var(--g500); transform: rotate(45deg); transition: transform .15s; }
.cs-btn[aria-expanded="true"] .cs-chev { transform: rotate(225deg); margin-top: 3px; }
.cs-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; min-width: 100%; width: max-content; max-width: 280px; max-height: 320px; overflow-y: auto; margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid var(--g200); border-radius: 14px; box-shadow: 0 12px 32px rgba(11,11,12,0.12); }
.cs-head { padding: 6px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--g500); }
.cs-menu [role=option] { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: 9px; font-size: 13px; color: var(--g700); cursor: pointer; outline: none; }
.cs-menu [role=option]:hover, .cs-menu [role=option]:focus { background: var(--g100); color: var(--ink); }
.cs-menu [role=option][aria-selected=true] { font-weight: 600; color: var(--ink); }
.cs-tick { color: var(--amber-deep); font-weight: 700; }
.sidebar .logo { gap: 10px; justify-content: flex-start; }
.sidebar .logo .client-switch { flex: 0 1 auto; }
.sidebar .logo .signout { margin-left: auto; }
.sidebar .logo .signout { flex: none; font-size: 12px; }
header.top .client-switch { max-width: 230px; }

/* Which client am I looking at? */
.client-pill { display: inline-flex; align-items: center; gap: 8px; margin-right: 12px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--g100); font-size: 13px; color: var(--ink); vertical-align: middle; }
.client-pill:not(.admin) { padding-left: 12px; }
.client-pill.admin { background: var(--butter); box-shadow: inset 0 0 0 1px rgba(232,154,26,.45); }
.client-pill .tag { padding: 2px 8px; border-radius: 999px; background: var(--ink); color: var(--amber); font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.topleft { display: flex; flex-wrap: wrap; align-items: center; row-gap: 6px; min-width: 0; }

/* Admin inline editing */
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-ghost { border: 1px dashed var(--g400); background: #fff; color: var(--ink); }
.btn-ghost:hover { border-style: solid; border-color: var(--ink); }
.btn-danger { border: 1px solid var(--g300); background: #fff; color: #A3121F; }
.btn-danger:hover { border-color: var(--red); }
dialog.editor { border: 0; border-radius: 20px; padding: 0; width: min(640px, 94vw); max-height: 90vh; box-shadow: 0 18px 48px rgba(11,11,12,0.25); }
dialog.editor::backdrop { background: rgba(11,11,12,0.45); }
.editor form { display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.editor h2 { font-size: 20px; }
.editor .f { display: flex; flex-direction: column; gap: 6px; }
.editor .f label { font-size: 13px; font-weight: 600; color: var(--ink); }
.editor .f input, .editor .f select, .editor .f textarea { min-height: 42px; padding: 8px 12px; border: 1px solid var(--g300); border-radius: 10px; font: inherit; font-size: 14px; color: var(--ink); background: #fff; }
.editor .f textarea { min-height: 80px; resize: vertical; }
.editor .hint { font-size: 12px; color: var(--g500); }
.editor .grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.editor .form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 6px; }
.editor .preview { border-radius: 12px; overflow: hidden; background: var(--ink); aspect-ratio: 16/9; }
.editor .preview iframe { width: 100%; height: 100%; border: 0; }

/* Badges */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badges.sm { grid-template-columns: repeat(6, 1fr); gap: 6px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 16px 10px; border-radius: 16px; border: 1px dashed var(--g300); background: #fff; color: var(--g500); }
.badge .em { font-size: 30px; line-height: 1; filter: grayscale(1); opacity: .5; }
.badge .nm { font-family: var(--display); font-weight: 600; font-size: 14px; color: var(--g600); }
.badge .ht { font-size: 12px; line-height: 1.4; }
.badge.earned { border: 1px solid rgba(232,154,26,.5); background: var(--butter); color: var(--g700); }
.badge.earned .em { filter: none; opacity: 1; }
.badge.earned .nm { color: var(--ink); }
.badges.sm .badge { padding: 8px 2px; border-radius: 10px; }
.badges.sm .badge .em { font-size: 20px; }
.badges.sm .badge .nm, .badges.sm .badge .ht { display: none; }

/* Celebration pop-up */
.celebrate { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: rgba(11,11,12,.45); overflow: hidden; padding: 20px; }
.celebrate .card { position: relative; z-index: 1; width: min(440px, 100%); background: #fff; border-radius: 24px; padding: 32px; text-align: center; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 18px 48px rgba(11,11,12,.25); }
.celebrate .big { font-size: 48px; }
.celebrate h2 { font-size: 24px; }
.celebrate p { margin: 0; font-size: 15px; line-height: 1.6; }
.celebrate .row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.confetti { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall 2.6s ease-in forwards; }
@keyframes fall { to { top: 110vh; transform: rotate(720deg) translateX(40px); } }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }

/* Unread count on nav icons and tiles */
.sections a { position: relative; }
.count-dot { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }

@media print {
  .sidebar, .topbar .actions, .no-print { display: none !important; }
  .main { flex: 1 1 100%; }
}
