/* I4 product design tokens — light mode is the default shared by internal apps. */
/* Inter is local because the Portal CSP blocks third-party font CSS. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-ext.woff2") format("woff2");
}

:root {
  --i4-font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --i4-font-heading: var(--i4-font-sans);
  --i4-background: #f1f5f9;
  --i4-card: #ffffff;
  --i4-primary: #00b8d4;
  --i4-primary-strong: #0891b2;
  --i4-foreground: #0f172a;
  --i4-muted: #64748b;
  --i4-border: #e2e8f0;
  --i4-nav: #0f172a;
  --i4-success: #22c55e;
  --i4-warning: #f59e0b;
  --i4-error: #ef4444;
  --i4-radius-card: 12px;
  --i4-radius-control: 8px;
  --i4-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  /* Compatibility aliases for the original portal stylesheet. */
  --ink: var(--i4-foreground);
  --muted: var(--i4-muted);
  --line: var(--i4-border);
  --sky: var(--i4-primary);
  --sky-dark: var(--i4-primary-strong);
  --navy: var(--i4-nav);
  --pale: var(--i4-background);
  --white: var(--i4-card);
  --amber: var(--i4-warning);
  --green: var(--i4-success);
  --shadow: var(--i4-shadow);
}

html[data-theme="dark"] {
  --i4-background: #0f172a;
  --i4-card: #1e293b;
  --i4-primary: #00b8d4;
  --i4-primary-strong: #22d3ee;
  --i4-foreground: #f1f5f9;
  --i4-muted: #94a3b8;
  --i4-border: #334155;
  --i4-nav: #020617;
  --i4-success: #22c55e;
  --i4-warning: #fbbf24;
  --i4-error: #f87171;
  --i4-shadow: 0 4px 20px -4px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--i4-background);
  color: var(--i4-foreground);
  font-family: var(--i4-font-sans);
}

button,
input,
textarea,
select { font-family: var(--i4-font-sans); }

.shell { flex: 1; padding: clamp(20px, 3vw, 44px); }
.topbar { margin-bottom: 22px; }
.login { border-color: var(--i4-border); border-radius: var(--i4-radius-card); box-shadow: var(--i4-shadow); }
.login h1, .view-head h1, .modal h2, .report-preview-head h2, .report-history h2, .report-summary h3 { font-family: var(--i4-font-heading); color: var(--i4-foreground); }
.login h1 { font-size: 2rem; font-weight: 600; letter-spacing: -.035em; }
.view-head h1 { font-size: 1.5rem; line-height: 2rem; font-weight: 600; letter-spacing: -.025em; }
.navbar-brand-copy strong { font-weight: 600; }
.primary-navigation .navbutton, .nav-menu-item { font-weight: 500; }
.btn, .google { font-weight: 600; }
.field label, .status, .dashboard-count, .dashboard-ticket-number, .dashboard-ticket strong, .dashboard-section-head h2, .report-confirmation dt, .ticket-priority select { font-weight: 600; }
.eyebrow, .dashboard-metric b, .report-metrics b { font-weight: 600; }
.eyebrow { color: var(--i4-primary-strong); }
.security { color: var(--i4-muted) !important; }
.security span { color: var(--i4-success); }
.google { border-color: var(--i4-border); border-radius: var(--i4-radius-control); }
.google:hover { border-color: var(--i4-primary); box-shadow: 0 0 0 3px rgba(0, 184, 212, .12); }
.theme-toggle { border: 1px solid rgba(148, 163, 184, .42); border-radius: var(--i4-radius-control); background: transparent; color: inherit; padding: 7px 10px; font-size: .78rem; font-weight: 650; }
.theme-toggle:hover { border-color: var(--i4-primary); color: var(--i4-primary); }

.header { background: var(--i4-nav); border-radius: var(--i4-radius-card); box-shadow: var(--i4-shadow); }
.header .mark { background: rgba(0, 184, 212, .16); color: var(--i4-primary); }
.avatar { background: rgba(0, 184, 212, .18); color: #d8fbff; }
.layout { gap: 24px; }
.navbutton { color: var(--i4-muted); border-radius: var(--i4-radius-control); }
.navbutton.active, .navbutton:hover { background: rgba(0, 184, 212, .1); color: #087b93; }
.aside-note { border-left-color: var(--i4-primary); background: rgba(0, 184, 212, .07); color: #475569; border-radius: 0 var(--i4-radius-control) var(--i4-radius-control) 0; }

.card { background: var(--i4-card); border-color: var(--i4-border); border-radius: var(--i4-radius-card); box-shadow: var(--i4-shadow); }
.field select, .field textarea, .table input, .table select { border-color: #cbd5e1; border-radius: var(--i4-radius-control); }
.field select:focus, .field textarea:focus { outline-color: rgba(0, 184, 212, .22); border-color: var(--i4-primary-strong); }
.drop { background: #f8fafc; border-color: #94a3b8; border-radius: var(--i4-radius-control); }
.drop strong { color: var(--i4-primary-strong); }
.btn { border-radius: var(--i4-radius-control); }
.btn.primary { background: var(--i4-primary); color: var(--i4-foreground); }
.btn.primary:hover { background: #06a9c2; }
.btn.secondary { background: #f1f5f9; color: #334155; }
.btn.secondary:hover { background: #e2e8f0; }
.btn.danger { background: rgba(239, 68, 68, .12); color: #b91c1c; }

.status.ready { background: rgba(34, 197, 94, .12); color: #15803d; }
.status.created { background: rgba(34, 197, 94, .12); color: #15803d; }
.status.draft { background: rgba(245, 158, 11, .14); color: #a16207; }
.ticket, .detail-ticket { border-color: var(--i4-border); }
.ticket input { accent-color: var(--i4-primary-strong); }
.tag { background: #f1f5f9; color: #475569; }
.table th { color: var(--i4-muted); }
.table td { border-color: var(--i4-border); }
.table-link { color: #087b93; }
.table-link:hover { color: #0e7490; }
.notice { background: rgba(34, 197, 94, .12); color: #15803d; }
.notice.error { background: rgba(239, 68, 68, .12); color: #b91c1c; }
.release { border-left-color: var(--i4-primary); }
.modal { border-radius: var(--i4-radius-card); box-shadow: 0 20px 50px rgba(15, 23, 42, .25); }
.icon-button { color: var(--i4-muted); }

.btn:focus-visible,
.google:focus-visible,
.table-link:focus-visible,
.theme-toggle:focus-visible,
.icon-button:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible,
.table input:focus-visible,
.table select:focus-visible,
.report-dates input:focus-visible {
  outline: 3px solid rgba(0, 184, 212, .32);
  outline-offset: 2px;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 11px clamp(20px, 3vw, 44px);
  background: var(--i4-nav);
  color: #94a3b8;
  font-size: .78rem;
  letter-spacing: .02em;
}
.app-footer strong { color: var(--i4-primary); font-weight: 650; }
.app-footer .separator { color: #475569; padding: 0 10px; }

/* Application chrome: full-width workspace, visible navigation and a fixed footer. */
.shell { padding: 0; width: 100%; max-width: none; }
.topbar { padding: 18px clamp(20px, 2vw, 40px); margin: 0; }
.header { width: 100%; border-radius: 0; padding: 14px clamp(20px, 2vw, 40px); }
.app-navbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: clamp(18px, 2vw, 32px); }
.navbar-brand { display: flex; align-items: center; gap: 10px; min-width: max-content; }
.navbar-logo { display: block; width: 36px; height: 40px; overflow: hidden; flex: 0 0 36px; }
.navbar-logo img { display: block; width: 36px; height: auto; max-width: none; }
.navbar-brand-copy { display: grid; gap: 2px; line-height: 1.1; }
.navbar-brand-copy strong { color: #f8fafc; font-size: .9rem; font-weight: 700; letter-spacing: -.015em; }
.navbar-brand-copy small { color: #94a3b8; font-size: .72rem; }
.primary-navigation { display: flex; align-items: center; gap: 3px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.primary-navigation::-webkit-scrollbar { display: none; }
.primary-navigation .navbutton { width: auto; flex: 0 0 auto; margin: 0; padding: 9px 11px; border: 0; border-radius: var(--i4-radius-control); background: transparent; color: #94a3b8; font-size: .84rem; font-weight: 650; line-height: 1.15; }
.primary-navigation .navbutton.active, .primary-navigation .navbutton:hover, .primary-navigation .navbutton:focus-visible { background: var(--i4-primary); color: #0f172a; outline: 0; }
.admin-navigation { display: flex; align-items: center; gap: 3px; }
.layout { position: relative; display: block; margin: 0; padding: 28px clamp(20px, 2vw, 40px) 68px; }
.main { width: 100%; min-width: 0; }
.app-footer { position: fixed; right: 0; bottom: 0; left: 0; z-index: 30; min-height: 38px; padding: 10px clamp(20px, 2vw, 40px); }
.modal-backdrop { z-index: 40; }

html[data-theme="dark"] .topbar .brand { color: var(--i4-foreground); }
html[data-theme="dark"] .login,
html[data-theme="dark"] .card,
html[data-theme="dark"] .modal { background: var(--i4-card); }
html[data-theme="dark"] .login p,
html[data-theme="dark"] .view-head p,
html[data-theme="dark"] .hint,
html[data-theme="dark"] .ticket p,
html[data-theme="dark"] .audit,
html[data-theme="dark"] .release p,
html[data-theme="dark"] .release ul,
html[data-theme="dark"] .detail-ticket span { color: var(--i4-muted); }
html[data-theme="dark"] .google,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .table input,
html[data-theme="dark"] .table select { background: #0f172a; color: var(--i4-foreground); border-color: #475569; }
html[data-theme="dark"] .drop { background: #0f172a; border-color: #64748b; color: var(--i4-muted); }
html[data-theme="dark"] .btn.secondary { background: #334155; color: var(--i4-foreground); }
html[data-theme="dark"] .btn.secondary:hover { background: #475569; }
html[data-theme="dark"] .tag { background: #334155; color: #cbd5e1; }
html[data-theme="dark"] .aside-note { background: rgba(0, 184, 212, .09); color: #cbd5e1; }
html[data-theme="dark"] .navbutton { color: var(--i4-muted); }
html[data-theme="dark"] .navbutton.active,
html[data-theme="dark"] .navbutton:hover { color: #67e8f9; background: rgba(0, 184, 212, .14); }
html[data-theme="dark"] .table th { color: var(--i4-muted); }
html[data-theme="dark"] .table-link { color: #67e8f9; }
html[data-theme="dark"] .table-link:hover { color: #a5f3fc; }
html[data-theme="dark"] .status.ready { background: rgba(34, 197, 94, .16); color: #86efac; }
html[data-theme="dark"] .status.created { background: rgba(34, 197, 94, .16); color: #86efac; }
html[data-theme="dark"] .status.draft { background: rgba(251, 191, 36, .16); color: #fde68a; }
html[data-theme="dark"] .notice { background: rgba(34, 197, 94, .16); color: #86efac; }
html[data-theme="dark"] .notice.error { background: rgba(248, 113, 113, .16); color: var(--i4-error); }
html[data-theme="dark"] .btn.danger { background: rgba(248, 113, 113, .16); color: var(--i4-error); }
html[data-theme="dark"] .proposal-mode {
  background: #1e293b;
  border-color: #475569;
  color: var(--i4-foreground);
}
html[data-theme="dark"] .proposal-mode small { color: #cbd5e1; }
html[data-theme="dark"] .proposal-mode.active {
  background: rgba(0, 184, 212, .12);
  border-color: var(--i4-primary-strong);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, .18);
}
html[data-theme="dark"] .assistant-note {
  background: rgba(0, 184, 212, .12);
  color: #cffafe;
}
html[data-theme="dark"] .mcp-workspace-card { background: var(--i4-card); color: var(--i4-foreground); }
html[data-theme="dark"] .mcp-workspace-card small { color: var(--i4-muted); }

/* Report workspace: summary first, exports always available from the same run. */
.report-form { margin-bottom: 20px; }
.mcp-workspace { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.mcp-workspace-card { display: grid; gap: 8px; min-height: 172px; padding: 20px; border: 1px solid var(--i4-border); border-radius: var(--i4-radius-card); background: var(--i4-card); color: var(--i4-foreground); text-align: left; box-shadow: var(--i4-shadow); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.mcp-workspace-card:hover, .mcp-workspace-card:focus-visible { border-color: var(--i4-primary); box-shadow: 0 0 0 3px rgba(0, 184, 212, .14); outline: 0; transform: translateY(-1px); }
.mcp-workspace-card strong { font-family: var(--i4-font-heading); font-size: 1.12rem; }
.mcp-workspace-card small { color: var(--i4-muted); font-size: .86rem; line-height: 1.45; }
.mcp-assistant-card { max-width: 920px; }
.mcp-assistant-card textarea { min-height: 130px; }
.mcp-assistant-actions { align-items: center; }
.mcp-assistant-actions .hint { margin-right: auto; }
.ticket-priority { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 6px; background: #edf6fa; color: #356176; font-size: .74rem; }
.ticket-priority select { border: 0; background: transparent; color: inherit; font: inherit; font-weight: 700; padding: 2px; }
html[data-theme="dark"] .ticket-priority { background: #334155; color: #cbd5e1; }
.report-dates { margin-top: 16px; }
.report-dates input { width: 100%; border: 1px solid #cbd5e1; border-radius: var(--i4-radius-control); background: var(--i4-card); color: var(--i4-foreground); padding: 12px; }
.field-optional { font-weight: 400; }
.field--spaced { margin-top: 18px; }
.hint--spaced { margin-top: 18px; }
.table-input { width: 100%; padding: 7px; }
.table-input--prefix { width: 110px; }
.table-select { padding: 7px; }
.report-preview { margin-top: 20px; }
.report-preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.report-preview-head h2 { margin: 0; font-family: var(--i4-font-sans); font-size: 1.3rem; color: var(--i4-foreground); }
.report-preview-head p:not(.eyebrow) { margin: 6px 0 0; color: var(--i4-muted); }
.report-downloads { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.report-downloads a { text-decoration: none; white-space: nowrap; }
.report-downloads .btn.secondary { background: #f3f4f6; border: 1px solid #d1d5db; color: #334155; transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease; }
.report-downloads .btn.secondary:hover, .report-downloads .btn.secondary:focus-visible { background: rgba(0, 184, 212, .12); border-color: var(--i4-primary); color: #087b93; }
.report-downloads .btn.secondary:active { background: var(--i4-primary); border-color: var(--i4-primary); color: var(--i4-foreground); transform: translateY(1px); }
.report-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 18px 0 24px; }
.report-metrics > div { min-width: 0; padding: 14px; border: 1px solid var(--i4-border); border-top: 3px solid var(--i4-primary); border-radius: var(--i4-radius-control); }
.report-metrics b { display: block; color: var(--i4-foreground); font-size: 1.65rem; line-height: 1.1; }
.report-metrics span { display: block; margin-top: 6px; color: var(--i4-muted); font-size: .8rem; }
.report-confirmation { display: grid; grid-template-columns: minmax(110px, auto) minmax(0, 1fr); gap: 9px 16px; margin: 18px 0; padding: 14px; border: 1px solid var(--i4-border); border-left: 3px solid var(--i4-primary); border-radius: var(--i4-radius-control); }
.report-confirmation dt { color: var(--i4-muted); font-weight: 700; }
.report-confirmation dd { margin: 0; color: var(--i4-foreground); }
.report-summary { padding: 4px 0 16px; }
.report-summary h3 { margin: 0 0 8px; font-size: 1rem; }
.report-summary ul { margin: 0; padding-left: 20px; color: var(--i4-muted); line-height: 1.5; }
.report-history { margin-top: 30px; }
.report-history h2 { margin: 0 0 12px; font-family: var(--i4-font-sans); font-size: 1.2rem; color: var(--i4-foreground); }

html[data-theme="dark"] .report-dates input { border-color: #475569; background: #0f172a; color: var(--i4-foreground); }
html[data-theme="dark"] .report-metrics > div { background: rgba(15, 23, 42, .35); }
html[data-theme="dark"] .report-confirmation { background: rgba(15, 23, 42, .35); border-color: #475569; border-left-color: var(--i4-primary); }
html[data-theme="dark"] .report-downloads .btn.secondary { background: #334155; border-color: #475569; color: var(--i4-foreground); }
html[data-theme="dark"] .report-downloads .btn.secondary:hover, html[data-theme="dark"] .report-downloads .btn.secondary:focus-visible { background: rgba(0, 184, 212, .18); border-color: var(--i4-primary); color: #a5f3fc; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media (max-width: 760px) {
  .topbar { padding: 14px 17px; }
  .header { padding: 11px 17px; }
  .app-navbar { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 14px; }
  .navbar-logo { width: 32px; height: 36px; flex-basis: 32px; }
  .navbar-logo img { width: 32px; }
  .navbar-brand-copy strong { font-size: .82rem; }
  .navbar-brand-copy small { font-size: .67rem; }
  .primary-navigation { grid-column: 1 / -1; width: 100%; padding-bottom: 1px; }
  .primary-navigation .navbutton { padding: 8px 10px; font-size: .8rem; }
  .layout { padding: 20px 17px 86px; }
  .view-head h1 { font-size: 1.375rem; line-height: 1.8rem; }
  .app-footer { align-items: flex-start; flex-direction: column; gap: 4px; min-height: 58px; padding: 8px 17px; }
  .report-preview-head { align-items: stretch; flex-direction: column; }
  .mcp-assistant-actions { align-items: stretch; flex-direction: column; }
  .mcp-assistant-actions .hint { margin-right: 0; }
  .report-downloads { justify-content: flex-start; }
  .report-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-confirmation { grid-template-columns: 1fr; gap: 4px; }
  .report-confirmation dt:not(:first-child) { margin-top: 8px; }
}


/* The request textarea and actions must occupy their own rows, not stretch as a
   second grid column next to each other. */
.request-details,
.attachments-field,
.new-request-actions { grid-column: 1 / -1; }

.attachments-field { margin-top: 4px; }

/* Operation checks use a dedicated surface in dark mode rather than the
   light-only card color from the original stylesheet. */
html[data-theme="dark"] .operation-check {
  background: #1e293b;
  border-color: #334155;
}
html[data-theme="dark"] .operation-check b { color: var(--i4-foreground); }
