/* ==========================================================================
   TOOROCOLLAB — UI POLISH LAYER (loaded after main.css & portal.css)
   One font, one palette, consistent buttons/inputs/cards, accessible focus,
   no horizontal scroll, good tap targets. Works in day & night mode.
   ========================================================================== */

:root {
  /* Palette — primary emerald, accent teal, neutrals, status colours */
  --primary: #0ea36f;
  --primary-strong: #0b8a5d;
  --accent: #0ea36f;
  --accent-2: #0d9aa8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #e5484d;
  --info: #0284c7;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* Spacing scale 4 / 8 / 12 / 16 / 24 / 32 / 48 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --radius-s: 10px;
  --radius-m: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
:root[data-theme="dark"] {
  --accent: #34d399;
  --primary: #34d399;
  --text-faint: #8a9a93;   /* better contrast on dark */
  --border: rgba(255, 255, 255, 0.14);
  --danger: #ff6b6b;
}

/* One font family everywhere (except code/credential boxes) */
html, body, button, input, select, textarea { font-family: var(--font); }
body *:not(.tcn-cred):not(code):not(pre):not(kbd) { font-family: var(--font) !important; }
h1, h2, h3, h4, .display { letter-spacing: -0.02em; font-weight: 800; }
body { line-height: 1.6; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: clip; }
html { overflow-x: clip; }
p, li, td, th, label, .muted { overflow-wrap: anywhere; }

/* Images never stretch; broken images collapse instead of showing an icon */
img { max-width: 100%; height: auto; }
img:not([src]), img[src=""] { visibility: hidden; }

/* Buttons — same height, radius and states everywhere */
.btn { border-radius: 12px; min-height: 40px; font-weight: 700; letter-spacing: 0; transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease); display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn-sm { min-height: 36px; border-radius: 10px; }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-primary { background: linear-gradient(135deg, #10b981 0%, #0ea5a4 100%); color: #fff; }
:root[data-theme="dark"] .btn-primary { color: #04140c; }
.btn-danger { font-weight: 700; }
.btn-line { color: var(--text); }

/* Visible keyboard focus */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(16, 185, 129, .55); outline-offset: 2px; border-radius: 10px;
}

/* Inputs — same height, radius, focus */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]), select, textarea { border-radius: 10px; }
.field input, .field select, .field textarea, .tcn-input, .tcn-field input, .tcn-field select, .tcn-field textarea { min-height: 44px; font-size: 15px; }
.field label { font-weight: 600; }

/* Cards — consistent radius, soft shadow, smooth hover */
.card, .tcn-card, .tp-card, .tcn-kpi, .tcn-bcard, .tcn-fcard { border-radius: 16px; }
.card.tilt { transition: transform .2s var(--ease), box-shadow .2s var(--ease); }

/* Creator & brand cards: equal heights in grids, long names wrap nicely */
.tcp-grid { align-items: stretch; }
.tcp-card { height: 100%; cursor: pointer; }
.tcp-card:focus-visible { outline: 3px solid rgba(16, 185, 129, .6); outline-offset: 3px; }
.tcp-name, .tcp-meta { max-width: 100%; overflow-wrap: anywhere; }
.tcp-photo img { aspect-ratio: 1 / 1; }

/* Toasts */
.tcn-toast { border-radius: 14px; font-weight: 600; box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .45); }

/* Theme toggle sits above the WhatsApp button on small screens */
#tcnTheme { width: 46px; height: 46px; }

/* Portal: sidebar / topbar polish */
.portal-sidebar-nav .portal-nav-item { min-height: 44px; border-radius: 10px; }
.portal-sidebar-nav .portal-nav-item.active { font-weight: 700; }
.portal-topbar { gap: 10px; }
.portal-topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.portal-topbar-left .current { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-main { min-width: 0; }

/* Tables scroll inside their box, never the page */
.tcn-tablebox, .table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Smooth, subtle page entrance */
@keyframes tcFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#publicContent > *, .portal-main > main > * { animation: tcFade .22s var(--ease); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* Mobile: 44px tap targets, readable text, no overflow */
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .btn, .btn-sm { min-height: 44px; }
  .tcn-toolbar { gap: 8px; }
  .tcn-toolbar .tcn-input, .tcn-toolbar select { max-width: none !important; flex: 1 1 100%; }
  .tp-hide-sm { display: none !important; }
  .tcn-head h1 { font-size: 24px !important; }
  .tcn-modal { padding: 12px; }
  .tcn-modal .box { padding: 18px; border-radius: 18px; }
  .portal-topbar { padding-left: 12px; padding-right: 12px; }
  .wa-float .wa-text { display: none; }
}
