/* ==========================================================================
   Shared tokens, reset and components (dashboard + management portal)
   Palette matches the Potolo brand (logo teal #32B0C6) used across Potolo apps.
   ========================================================================== */

:root {
  --brand: #32b0c6;
  --on-brand: #0b0b0b;
  --brand-strong: color-mix(in oklab, var(--brand) 82%, black);
  --brand-text: color-mix(in oklab, var(--brand) 64%, black);
  --brand-soft: color-mix(in oklab, var(--brand) 13%, transparent);
  --brand-ring: color-mix(in oklab, var(--brand) 35%, transparent);

  --bg: #f5f4f6;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #efeef1;
  --surface-hover: #f9f8fa;
  --border: #e2e1e5;
  --border-strong: #d0cfd5;
  --text: #16151a;
  --text-2: #46454c;
  --text-3: #6b6a71;

  --green: #1a7f4b;
  --green-soft: #e7f5ee;
  --green-text: #1a7f4b;
  --red: #b02a37;
  --red-soft: #fbe9eb;
  --red-text: #b02a37;
  --blue-soft: #e8f2f9;
  --blue-text: #1c6fa8;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-xs: 0 1px 2px rgba(16, 15, 20, .05);
  --shadow-sm: 0 1px 3px rgba(16, 15, 20, .08), 0 6px 20px rgba(16, 15, 20, .05);
  --shadow-md: 0 12px 24px -6px rgba(16, 15, 20, .10), 0 4px 8px -4px rgba(16, 15, 20, .05);
  --shadow-lg: 0 24px 48px -12px rgba(16, 15, 20, .18);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand-strong: color-mix(in oklab, var(--brand) 82%, white);
    --brand-text: color-mix(in oklab, var(--brand) 80%, white);
    --brand-soft: color-mix(in oklab, var(--brand) 18%, transparent);
    --bg: #141414;
    --bg-elevated: #1a1a1a;
    --surface: #1e1e1e;
    --surface-2: #272729;
    --surface-hover: #232325;
    --border: #2f2f2f;
    --border-strong: #3e3e41;
    --text: #ececee;
    --text-2: #c5c4ca;
    --text-3: #9b9aa1;
    --green: #4dbd8a;
    --green-soft: #142c22;
    --green-text: #4dbd8a;
    --red: #e35d6a;
    --red-soft: #3a1d20;
    --red-text: #e35d6a;
    --blue-soft: #14242f;
    --blue-text: #63b3e8;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
    --shadow-md: 0 12px 24px -6px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --brand-strong: color-mix(in oklab, var(--brand) 82%, white);
  --brand-text: color-mix(in oklab, var(--brand) 80%, white);
  --brand-soft: color-mix(in oklab, var(--brand) 18%, transparent);
  --bg: #141414;
  --bg-elevated: #1a1a1a;
  --surface: #1e1e1e;
  --surface-2: #272729;
  --surface-hover: #232325;
  --border: #2f2f2f;
  --border-strong: #3e3e41;
  --text: #ececee;
  --text-2: #c5c4ca;
  --text-3: #9b9aa1;
  --green: #4dbd8a;
  --green-soft: #142c22;
  --green-text: #4dbd8a;
  --red: #e35d6a;
  --red-soft: #3a1d20;
  --red-text: #e35d6a;
  --blue-soft: #14242f;
  --blue-text: #63b3e8;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-md: 0 12px 24px -6px rgba(0, 0, 0, .5);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* --- Reset ---------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.015em; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.icon { flex-shrink: 0; }
.muted { color: var(--text-3); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Theme toggle shows the icon for the theme you'd switch to. */
.show-dark { display: none; }
:root[data-theme="dark"] .show-dark { display: inline-flex; }
:root[data-theme="dark"] .show-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .show-dark { display: inline-flex; }
  :root:not([data-theme="light"]) .show-light { display: none; }
}

/* --- Brand ---------------------------------------------------------------- */

.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { height: 30px; width: auto; max-width: 160px; object-fit: contain; }
.brand-logo-lg { height: 40px; max-width: 200px; }
.brand-divider { width: 1px; height: 22px; background: var(--border-strong); }
.brand-name { font-weight: 600; font-size: 15px; color: var(--text-2); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; white-space: nowrap; line-height: 1;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,.15); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--surface-hover); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
:root[data-theme="dark"] .btn-danger { color: #111; }
.btn-danger:hover { background: color-mix(in oklab, var(--red) 85%, black); }
.btn-danger-text { color: var(--red-text); }
.btn-danger-text:hover { background: var(--red-soft); color: var(--red-text); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2);
  transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn-danger:hover { background: var(--red-soft); color: var(--red-text); }

.badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em; vertical-align: middle;
  background: var(--brand-soft); color: var(--brand-text);
}

.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--text-2);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Keep uploaded logos legible in dark mode: many have dark text on transparency. */
:root[data-theme="dark"] .app-icon:has(img:not([hidden])),
:root[data-theme="dark"] .mini-icon:has(img) { background: #f4f6f9; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .app-icon:has(img:not([hidden])),
  :root:not([data-theme="light"]) .mini-icon:has(img) { background: #f4f6f9; }
}
