/* Codegenify 2026 unified interface layer.
   Loaded after legacy styles to preserve backend markup and contracts. */
:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface2: #ffffff;
  --card: #ffffff;
  --text: #0b1729;
  --muted: #5d6b80;
  --line: #dbe3ee;
  --brand: #155eef;
  --brand2: #0ea5e9;
  --primary: #155eef;
  --ok: #067647;
  --warn: #b54708;
  --danger: #b42318;
  --info: #175cd3;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 14px 34px rgba(16, 24, 40, .09);
  --shadow-lg: 0 28px 72px rgba(16, 24, 40, .16);
  --radius-sm: 10px;
  --radius: 16px;
  --radius2: 22px;
  --focus: 0 0 0 4px rgba(21, 94, 239, .18);
  --sidebar: #0d1b2f;
  --sidebar-text: #d5deeb;
  --sidebar-muted: #93a4bc;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08101d;
  --surface: #101b2b;
  --surface2: #132033;
  --card: #101b2b;
  --text: #f2f6fc;
  --muted: #a8b5c8;
  --line: #26364c;
  --brand: #6ea8ff;
  --brand2: #38bdf8;
  --primary: #6ea8ff;
  --ok: #47cd89;
  --warn: #fdb022;
  --danger: #f97066;
  --info: #84adff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .18);
  --shadow: 0 18px 40px rgba(0, 0, 0, .28);
  --shadow-lg: 0 30px 78px rgba(0, 0, 0, .42);
  --sidebar: #050b14;
  --sidebar-text: #e5ebf4;
  --sidebar-muted: #9cadc3;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 0;
  margin: 0;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}
body::before, body::after { max-width: 100vw; }
img, video, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  box-shadow: var(--focus);
}
.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--surface);
  font-weight: 750;
  transform: translateY(-160%);
  transition: transform .18s ease;
}
.skip-link:focus { transform: none; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.container { width: min(1180px, calc(100% - 40px)); max-width: 1180px; margin-inline: auto; padding-inline: 0; }
.h1, h1 { letter-spacing: -.035em; }
h2, h3 { letter-spacing: -.02em; }
.lead, .muted, small { color: var(--muted); }

/* Shared controls */
.btn, .cg-btn, .cw-btn, .auth-submit, .auth-mini-btn, .auth-link-card {
  min-height: 44px;
  border-radius: 12px;
  font-weight: 720;
  box-shadow: none;
}
.btn {
  padding: 10px 15px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}
.btn:hover { transform: none; border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); box-shadow: var(--shadow-sm); }
.btn.primary, .auth-submit {
  border: 1px solid color-mix(in srgb, var(--brand) 75%, #000);
  background: var(--brand);
  color: #fff;
}
.card, .feature, .listing-card, .notice, .portal-kpi, .status-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.card { border-radius: var(--radius); }
.notice { border-radius: 12px; }
.notice.error-notice, .auth-error { border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); color: var(--danger); }
.success-panel { border: 1px solid color-mix(in srgb, var(--ok) 30%, var(--line)); background: color-mix(in srgb, var(--ok) 8%, var(--surface)); color: var(--ok); border-radius: 12px; padding: 13px 15px; }
.badge, .cw-badge {
  min-height: 26px;
  border: 1px solid color-mix(in srgb, var(--brand) 22%, var(--line));
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  color: var(--brand);
  font-size: .78rem;
  font-weight: 760;
  line-height: 1.2;
}
.input, input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  padding: 11px 13px;
}
textarea { min-height: 118px; resize: vertical; }
.input:focus, input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: var(--focus); outline: 0; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--brand); }
input[type="file"] { padding: 8px; }
.upload-box { min-height: 100px; border: 1px dashed color-mix(in srgb, var(--brand) 42%, var(--line)); border-radius: 13px; background: color-mix(in srgb, var(--brand) 4%, var(--surface)); }
.form, form { min-width: 0; }

/* Theme switch */
.theme-pull {
  position: static !important;
  width: auto !important;
  height: auto !important;
  transform: none !important;
  display: inline-flex;
  align-items: center;
}
.theme-pull__ceiling, .theme-pull__cord, .theme-pull__socket, .theme-pull__bulb, .theme-pull__hint { display: none !important; }
.theme-pull__handle {
  position: static !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px;
  transform: none !important;
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.theme-pull__handle::before { content: ""; width: 18px; height: 18px; border: 2px solid currentColor; border-radius: 50%; box-shadow: 0 -8px 0 -6px currentColor, 0 8px 0 -6px currentColor, 8px 0 0 -6px currentColor, -8px 0 0 -6px currentColor; }
[data-theme="dark"] .theme-pull__handle::before { border-radius: 50%; box-shadow: 6px -3px 0 -1px var(--surface); background: currentColor; }

/* Public navigation */
.cg-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px);
  box-shadow: none;
}
[data-theme="dark"] .cg-header { background: color-mix(in srgb, var(--bg) 91%, transparent); box-shadow: none; }
.cg-nav-wrap { height: 72px; display: grid; grid-template-columns: 180px 1fr auto; gap: 24px; }
.cg-brand, .cg-brand img { width: 152px; min-width: 0; max-height: 46px; object-fit: contain; }
.cg-nav-center { justify-self: center; padding: 0; gap: 3px; border: 0; background: transparent; box-shadow: none; }
.cg-nav-center a, .cg-nav-dropbtn { min-height: 42px; display: inline-flex; align-items: center; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-size: .91rem; font-weight: 690; }
.cg-nav-center a:hover, .cg-nav-dropbtn:hover { background: color-mix(in srgb, var(--brand) 7%, transparent); color: var(--brand); }
.cg-nav-actions { gap: 8px; }
.cg-portal, .cg-quote { min-height: 44px; padding: 0 15px; border-radius: 11px; font-size: .9rem; font-weight: 730; box-shadow: none; }
.cg-portal { background: var(--surface); border-color: var(--line); }
.cg-quote { background: var(--brand); border: 1px solid color-mix(in srgb, var(--brand) 75%, #000); }
.cg-menu-btn { width: 44px; height: 44px; border-radius: 11px; }
.cg-theme-pull { position: static; }
.cg-nav-dropmenu { top: calc(100% + 8px); width: 300px; padding: 8px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.cg-nav-dropbtn[aria-expanded="true"] + .cg-nav-dropmenu { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.cg-nav-dropmenu a { display: block; padding: 12px; }
.cg-nav-dropmenu small { margin-top: 3px; }
.cg-drawer { top: 12px; right: 12px; bottom: 12px; width: min(440px, calc(100vw - 24px)); padding: 22px; border-radius: 20px; background: var(--surface); }
.cg-drawer h3 { font-size: 1.45rem; letter-spacing: -.03em; }
.cg-drawer-grid { gap: 8px; }
.cg-drawer-grid a { min-height: 0; padding: 14px; border-radius: 13px; }
.cg-drawer-card { border-radius: 14px; }

/* Public page system */
.cg-home { background: var(--bg); }
.cg-hero { padding: 72px 0 62px; background: #071426; overflow: hidden; }
.cg-hero::before { background: #071426; }
.cg-hero::after { opacity: .55; background-size: 64px 64px, 64px 64px, auto, auto; }
.cg-hero-grid { grid-template-columns: minmax(0, 1fr) minmax(440px, .95fr); min-height: 560px; gap: 52px; }
.cg-hero-copy h1 { max-width: 740px; font-size: clamp(3rem, 5.4vw, 5.65rem); line-height: .98; letter-spacing: -.065em; }
.cg-hero-copy p { max-width: 610px; line-height: 1.65; }
.cg-eyebrow { border-color: rgba(255,255,255,.16); background: rgba(255,255,255,.07); color: #d7e4f5; box-shadow: none; }
.cg-btn { border-radius: 11px; box-shadow: none; }
.cg-btn:hover { transform: translateY(-1px); }
.cg-btn-primary { background: #1f70ff; box-shadow: none; }
.cg-btn-light { box-shadow: none; }
.cg-laptop { transform: rotateY(-5deg) rotateX(2deg); border-radius: 20px; }
.cg-float-card { border-radius: 16px; }
.cg-products-section, .cg-value-section, .cg-cta-section { padding: 80px 0; background: var(--surface); }
[data-theme="dark"] .cg-products-section, [data-theme="dark"] .cg-value-section, [data-theme="dark"] .cg-cta-section { background: var(--bg); }
.cg-section-head h2 { font-size: clamp(2rem, 3.3vw, 3.6rem); letter-spacing: -.045em; }
.cg-product-grid { gap: 18px; }
.cg-product-card { border-radius: 16px; padding: 12px 12px 20px; box-shadow: var(--shadow-sm); }
.cg-product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.cg-product-preview { border-radius: 12px; }
.cg-product-icon { border-radius: 12px; }
.cg-value-grid { gap: 46px; }
.cg-value-cards { gap: 14px; }
.cg-value-cards div { border-radius: 14px; box-shadow: var(--shadow-sm); }
.cg-process-section { background: #071426; }
.cg-process-list div { border-radius: 14px; }
.cg-final-cta { border-radius: 20px; box-shadow: var(--shadow-sm); }
.section { padding: 64px 0; }
.section::after { display: none; }
.feature { border-radius: 14px; }
.premium-footer, .footer { background: #071426; color: #e7eef9; border-top: 0; }
.footer a, .footer small, .footer-copy { color: #aebdd1; }
.footer a:hover { color: #fff; }
.footer-icon-btn { border-color: rgba(255,255,255,.13) !important; background: rgba(255,255,255,.05) !important; }

/* Portal shell */
.nav { display: block !important; position: sticky; top: 0; z-index: 80; background: color-mix(in srgb, var(--surface) 94%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.nav-inner { min-height: 70px; padding: 10px 0; flex-wrap: nowrap; }
.brand-logo.full { width: 146px; max-height: 44px; object-fit: contain; }
.brand-logo.icononly { width: 42px; height: 42px; }
.nav-links { gap: 2px; flex-wrap: nowrap; }
.nav-links a { min-height: 42px; display: inline-flex; align-items: center; border: 0; border-radius: 10px; padding: 8px 10px; font-size: .9rem; font-weight: 680; }
.nav-actions { gap: 8px; min-width: 0; }
.nav-actions .badge { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-toggle { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--text); }
.dash { min-height: calc(100vh - 70px); grid-template-columns: 240px minmax(0, 1fr); }
.dash .side { top: 70px; height: calc(100vh - 70px); padding: 18px 14px; border-color: var(--line); background: var(--surface); overflow-y: auto; }
.side .profile-chip { margin-bottom: 12px; }
.side a { min-height: 44px; padding: 10px 11px; border: 1px solid transparent; border-radius: 10px; color: var(--muted); }
.side a:hover, .side a.active { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 18%, var(--line)); color: var(--brand); }
.dash .main { min-width: 0; padding: 28px 0 48px; }
.portal-hero { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); }
.portal-kpi-row, .kpis { gap: 14px; }
.portal-kpi, .kpi { min-width: 0; border-radius: 14px; box-shadow: var(--shadow-sm); }
.intern-profile-form, .intern-side-panel .card { border-radius: 16px; }

/* Admin shell */
.admin-shell { grid-template-columns: 258px minmax(0, 1fr); background: var(--bg); }
.admin-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 16px 12px; border-right: 0; background: var(--sidebar); color: var(--sidebar-text); }
.admin-brand { position: sticky; top: -16px; z-index: 2; margin: -4px -2px 10px; padding: 10px 5px 14px; background: var(--sidebar); border-bottom: 1px solid rgba(255,255,255,.09); }
.admin-logo { width: 38px; height: 38px; border-radius: 10px; }
.admin-brand small { color: var(--sidebar-muted) !important; }
.admin-nav a { min-height: 42px; margin: 2px 0; padding: 9px 11px; border-radius: 9px; color: var(--sidebar-muted); font-size: .91rem; }
.admin-nav a:hover, .admin-nav a.is-active { background: rgba(255,255,255,.08); color: #fff; }
.admin-label { color: var(--sidebar-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; }
.admin-sep { background: rgba(255,255,255,.1); }
.admin-main { min-width: 0; padding: 30px; }
.admin-main > .h1:first-child { margin: 0 0 22px; font-size: 1.8rem; }
.admin-main .grid-3 { gap: 14px; }
.admin-main .card { box-shadow: var(--shadow-sm); }
.admin-overlay { background: rgba(3,8,18,.56); backdrop-filter: blur(4px); }
.admin-burger { width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.12); border-radius: 10px; background: rgba(255,255,255,.06); color: #fff; }
.admin-mobile-burger { display: none; }
.theme-pull--fixed { position: fixed !important; top: 16px !important; right: 18px !important; z-index: 45; }

/* Data tables */
.table { min-width: 720px; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.table th { position: sticky; top: 0; z-index: 1; padding: 12px 14px; background: color-mix(in srgb, var(--bg) 82%, var(--surface)); color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.table td { padding: 13px 14px; background: var(--surface); vertical-align: top; }
.table tr:hover td { background: color-mix(in srgb, var(--brand) 3%, var(--surface)); }
.table-responsive, .card:has(> .table), .card[style*="overflow:auto"] { max-width: 100%; overflow-x: auto !important; }

/* Auth */
.auth-v3-wrap, .auth-admin-body { background: var(--bg); }
.auth-shell, .auth-admin-shell { gap: 20px; }
.auth-panel, .auth-card { border-radius: 18px; }
.auth-panel { background: #071426; color: #fff; }
.auth-title { letter-spacing: -.045em; }
.auth-card { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.auth-field input, .auth-field select { border-radius: 11px; }
.auth-eye { min-width: 58px; min-height: 44px; padding-inline: 10px; color: var(--muted); font-size: .78rem; font-weight: 720; }
.auth-admin-top { min-height: 72px; }

/* Client workspace compatibility */
.cw-pro-body { background: var(--bg) !important; }
.cw-shell { max-width: 100%; min-width: 0; }
.cw-sidebar { background: var(--sidebar) !important; color: var(--sidebar-text); }
.cw-main { min-width: 0; }
.cw-card, .cw-hero { border-radius: 16px !important; box-shadow: var(--shadow-sm) !important; }
.cw-btn, .cw-row, .cw-mini, .cw-col { border-radius: 11px !important; }
.cw-chat-panel { max-width: calc(100vw - 24px); max-height: calc(100vh - 96px); }
.cw-chat-form { display: grid; grid-template-columns: minmax(0,1fr) auto; }

/* Empty state upgrade without changing server conditions */
.notice:only-child, .cw-empty {
  padding: 22px;
  text-align: center;
  border-style: dashed;
  color: var(--muted);
}

@media (max-width: 1120px) {
  .cg-nav-wrap { grid-template-columns: auto 1fr auto; }
  .cg-nav-center { display: none; }
  .cg-menu-btn { display: grid; }
  .cg-hero-grid { grid-template-columns: 1fr; }
  .cg-hero-copy { max-width: 780px; }
  .cg-hero-visual { min-height: 520px; }
  .nav-links { position: fixed; inset: 70px 12px auto; z-index: 120; display: none; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg); }
  body.nav-open .nav-links { display: grid; }
  .nav-links a { width: 100%; }
  .nav-toggle { display: inline-grid; place-items: center; order: 3; }
  .nav-actions .badge, .nav-actions > .btn { display: none; }
}

@media (max-width: 980px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: fixed; z-index: 110; inset: 0 auto 0 0; width: min(285px, 86vw); height: 100dvh; transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.admin-open .admin-side { transform: none; }
  .admin-overlay { position: fixed; z-index: 109; inset: 0; display: none; }
  body.admin-open .admin-overlay { display: block; }
  .admin-main { padding: 76px 20px 28px; }
  .admin-mobile-burger { display: grid; place-items: center; position: fixed; top: 16px; left: 16px; z-index: 108; background: var(--sidebar); }
  .admin-side .admin-burger { position: static; }
  .theme-pull--fixed { top: 16px !important; }
  .dash { grid-template-columns: 1fr; }
  .dash .side { position: relative; top: auto; height: auto; display: flex; gap: 6px; overflow-x: auto; padding: 10px 20px; border-bottom: 1px solid var(--line); }
  .dash .side .profile-chip, .dash .side .side-title, .dash .side .hr, .dash .side > small { display: none; }
  .dash .side a { flex: 0 0 auto; }
  .portal-kpi-row, .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 720px) {
  .container { width: min(100% - 28px, 1180px); padding-inline: 0; }
  .cg-nav-wrap { height: 66px; gap: 8px; }
  .cg-brand, .cg-brand img { width: 128px; }
  .cg-theme-pull { display: none; }
  .cg-hero { padding: 48px 0 36px; }
  .cg-hero-grid { min-height: 0; gap: 26px; }
  .cg-hero-copy h1 { font-size: clamp(2.55rem, 13vw, 3.7rem); }
  .cg-actions { display: grid; }
  .cg-btn { width: 100%; }
  .cg-trust { display: none; }
  .cg-hero-visual { min-height: 370px; }
  .cg-laptop { top: 12px; transform: none; }
  .cg-float-card { display: none; }
  .cg-app-main { padding: 16px; }
  .cg-app-top button { display: none; }
  .cg-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .cg-project-list div { grid-template-columns: 18px minmax(0,1fr) 38px; }
  .cg-product-grid, .cg-value-cards, .grid-2, .grid-3, .footer-grid { grid-template-columns: 1fr; }
  .cg-products-section, .cg-value-section, .cg-cta-section, .section { padding: 52px 0; }
  .cg-section-head { align-items: flex-start; }
  .cg-final-cta { padding: 26px 18px; }
  .cg-drawer-grid { grid-template-columns: 1fr; }
  .nav-inner { min-height: 66px; }
  .nav-actions { margin-left: auto; }
  .brand-logo.full { width: 126px; }
  .portal-hero { padding: 20px !important; }
  .portal-kpi-row, .kpis { grid-template-columns: 1fr; }
  .dash .main { padding-top: 20px; }
  .admin-main { padding-inline: 14px; }
  .admin-main .grid-3 { grid-template-columns: 1fr; }
  .table { min-width: 640px; }
  .auth-shell, .auth-admin-shell { grid-template-columns: 1fr !important; padding-block: 20px; }
  .auth-panel { min-height: auto; padding: 26px !important; }
  .auth-product-grid { grid-template-columns: 1fr 1fr; }
  .auth-mock { display: none; }
  .cw-shell { grid-template-columns: 1fr !important; }
  .cw-sidebar { position: relative !important; width: 100% !important; height: auto !important; }
  .cw-nav { display: flex !important; overflow-x: auto; gap: 6px; }
  .cw-nav a { flex: 0 0 auto; }
  .cw-grid, .cw-two, .cw-three, .cw-kanban { grid-template-columns: 1fr !important; }
  .cw-main { padding: 14px !important; }
  .cw-float { right: 12px !important; bottom: 12px !important; }
  .cw-chat-panel { right: 12px !important; bottom: 72px !important; width: calc(100vw - 24px) !important; }
}

@media (max-width: 420px) {
  .cg-brand, .cg-brand img { width: 116px; }
  .cg-drawer { width: calc(100vw - 16px); inset: 8px; }
  .auth-product-grid { grid-template-columns: 1fr; }
  .theme-pull--fixed { right: 12px !important; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  [data-animate] { opacity: 1 !important; transform: none !important; }
}

@media print {
  .cg-header, .nav, .admin-side, .admin-overlay, .theme-pull, .footer, .cw-sidebar, .cw-float, .cw-chat-panel, button, .btn { display: none !important; }
  body, .admin-main, .cw-main { background: #fff !important; color: #000 !important; padding: 0 !important; }
  .admin-shell, .dash, .cw-shell { display: block !important; }
  .card, .table, .notice { box-shadow: none !important; border-color: #aaa !important; break-inside: avoid; }
  .table { min-width: 0; width: 100%; font-size: 10pt; }
  a { color: #000 !important; text-decoration: underline; }
}
