/* Theme the complete account/workspace shell, including its older dashboards
   and body-level dialogs. Engineering applications own their internal skin. */
:root {
  --bg: var(--iq-bg);
  --panel: var(--iq-surface);
  --panel-2: var(--iq-bg);
  --text: var(--iq-text);
  --muted: var(--iq-muted);
  --muted-2: var(--iq-muted);
  --line: var(--iq-line);
  --green: var(--iq-accent);
  --green-2: var(--iq-accent);
  --orange: var(--iq-orange);
  --danger: var(--iq-danger);
  --cyan: #086f86;
  --app-warning-bg: #fff4e7;
  --app-info-bg: #edf3fc;
  --app-danger-bg: #fff0f1;
  --app-shadow: 0 18px 64px #203a2e21;
  color-scheme: light;
  background: var(--iq-bg);
}
:root[data-dashboard-theme=dark] {
  --cyan: #7dd5e5;
  --app-warning-bg: #342a23;
  --app-info-bg: #233244;
  --app-danger-bg: #36272d;
  --app-shadow: 0 18px 64px #0005;
  color-scheme: dark;
}

body { background: var(--iq-bg); color: var(--iq-text); }
.iq-dashboard-shell { --cyan: #086f86; --orange: var(--iq-orange); --danger: var(--iq-danger); }
[data-dashboard-theme=dark] .iq-dashboard-shell { --cyan: #7dd5e5; }
.iq-dashboard-shell .orange, .confirm-dialog-brand .orange { color: #ff8500; }
.iq-dashboard-shell .product-dot-apiq { background: #ff8500; }
.iq-dashboard-shell .product-dot-rigiq { background: #ff3b30; }
.iq-dashboard-shell .product-dot-liftiq { background: #00d1ff; }
.iq-dashboard-shell .product-dot-siteiq { background: #19b76b; }
.iq-dashboard-shell .product-dot-fleetiq { background: #ffd400; }
.iq-dashboard-shell .app-header { border-top: 0; padding-top: 20px; }
.iq-dashboard-shell .app-header::before { inset: 0 0 auto; width: 100%; height: 5px; background: url("auth-brand/colour-band.svg") center / 100% 5px no-repeat; }
.iq-dashboard-shell .dashboard { max-width: 1540px; width: 100%; min-width: 0; margin: 0 auto; gap: 24px; font-size: 14px; line-height: 1.5; }
.iq-dashboard-shell .dashboard h1 { font-size: 30px; font-weight: 650; letter-spacing: -1px; line-height: 1.2; }
.iq-dashboard-shell .dashboard-summary { font-size: 13px; line-height: 1.65; font-weight: 400; }
.iq-dashboard-shell .eyebrow { color: var(--iq-muted); font-size: 10px; font-weight: 750; letter-spacing: 1.4px; }
.iq-dashboard-shell .list-heading h2 { font-size: 17px; font-weight: 650; letter-spacing: -.3px; }
.iq-dashboard-shell .list-heading > span { padding: 4px 9px; }
.iq-dashboard-shell .dashboard :is(label, .empty-state, .list-note, .form-message, .overview-more) { font-weight: 500; }
.iq-dashboard-shell .dashboard label { font-size: 12px; color: var(--iq-text); }
.iq-dashboard-shell .status-grid article { border-radius: 10px; background: var(--iq-surface); }
.iq-dashboard-shell .status-grid span { font-size: 10px; font-weight: 650; letter-spacing: .8px; }
.iq-dashboard-shell .status-grid strong { font-weight: 650; }
.iq-dashboard-shell :is(.project-form, .project-list-wrap, .scenario-editor, .product-action-panel, .product-dashboard-card, .project-control-panel) {
  border: 1px solid var(--iq-line);
  border-radius: 12px;
  background: var(--iq-surface);
  box-shadow: var(--iq-shadow);
  min-width: 0;
}
.iq-dashboard-shell :is(.product-dashboard-card p, .project-control-panel p:not(.eyebrow):not(.form-message), .planner-launch p:not(.eyebrow)) { font-size: 13px; font-weight: 400; line-height: 1.65; }
.iq-dashboard-shell .product-dashboard-card { padding: 22px; }
.iq-dashboard-shell .product-dashboard-card span { font-size: 10px; font-weight: 700; }
.iq-dashboard-shell .product-dashboard-card strong { font-size: 17px; font-weight: 650; }
.iq-dashboard-shell .product-action-panel { padding: 22px; }

/* LiftIQ and RigIQ use the same workspace/panel primitives as the APiQ view.
   Keep their surfaces explicit instead of inheriting legacy dark card fills. */
.product-dashboard-workspace { display: grid; gap: 24px; background: var(--iq-bg); color: var(--iq-text); }
.product-dashboard-workspace > .iq-page-heading { margin-bottom: 0; align-items: center; }
.product-dashboard-workspace :is(.product-dashboard-card, .product-action-panel) {
  background: var(--iq-surface);
  border: 1px solid var(--iq-line);
  border-radius: 12px;
  box-shadow: var(--iq-shadow);
  color: var(--iq-text);
}
.product-dashboard-workspace .product-dashboard-card { align-content: start; gap: 12px; }
.product-dashboard-workspace .product-dashboard-card h2 { font-size: 17px; font-weight: 650; letter-spacing: -.3px; }
.product-dashboard-workspace .product-action-panel { gap: 20px; padding: 22px; }
.product-dashboard-workspace .product-action-panel > .iq-panel-heading { margin: -22px -22px 0; padding: 20px 22px; }
.product-dashboard-workspace .product-action-panel > p:not(.form-message) { font-size: 13px; font-weight: 400; color: var(--iq-muted); line-height: 1.65; }
.product-dashboard-workspace[data-product=rigiq] .product-dashboard-actions { grid-template-columns: minmax(0, 1fr); }
.product-dashboard-workspace[data-product=rigiq] .product-action-panel { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.product-dashboard-workspace[data-product=rigiq] .iq-panel-heading { grid-column: 1 / -1; }
.product-dashboard-workspace[data-product=rigiq] .product-launch-link { justify-self: end; }
@media(max-width:700px) {
  .product-dashboard-workspace[data-product=rigiq] .product-action-panel { grid-template-columns: minmax(0, 1fr); }
  .product-dashboard-workspace[data-product=rigiq] .product-launch-link { justify-self: start; }
}
.iq-dashboard-shell :is(.project-row, .overview-row, .scenario-row, .admin-row, .metric-tile, .working-file-card, .user-audit-entry, .support-ticket-row, .support-ticket-summary, .support-message, .support-internal-note) {
  border-color: var(--iq-line);
  background: var(--iq-bg);
}
.iq-dashboard-shell :is(.project-row:hover, .project-row:focus-within, .support-ticket-row:hover, .support-ticket-row:focus-visible, .support-ticket-row.active) {
  border-color: var(--iq-accent);
  background: var(--iq-soft);
  transform: none;
}
.iq-dashboard-shell .metric-tile.warning { background: var(--app-warning-bg); border-color: color-mix(in srgb, var(--iq-orange) 30%, var(--iq-line)); }
.iq-dashboard-shell .metric-tile.review { background: var(--app-info-bg); border-color: color-mix(in srgb, var(--iq-blue) 30%, var(--iq-line)); }
.iq-dashboard-shell .metric-tile.danger { background: var(--app-danger-bg); border-color: color-mix(in srgb, var(--iq-danger) 30%, var(--iq-line)); }
.iq-dashboard-shell :is(.user-audit-table th, .user-audit-table td, .user-session-row) { border-color: var(--iq-line); }
.iq-dashboard-shell :is(.scenario-list, .user-directory-list, .support-ticket-list, .support-ticket-detail) { scrollbar-color: var(--iq-muted) var(--iq-bg); }
.iq-dashboard-shell .status-pill { padding: 4px 9px; font-size: 10px; font-weight: 650; }
.iq-dashboard-shell .status-pill:is(.current, .valid, .active) { color: var(--iq-accent); background: var(--iq-soft); }
.iq-dashboard-shell .status-pill:is(.warning, .recent) { color: var(--iq-orange); background: var(--app-warning-bg); }
.iq-dashboard-shell .status-pill.review { color: var(--iq-blue); background: var(--app-info-bg); }
.iq-dashboard-shell .status-pill.danger { color: var(--iq-danger); background: var(--app-danger-bg); }
.iq-dashboard-shell .status-pill:is(.offline, .muted) { color: var(--iq-muted); background: var(--iq-bg); }

/* Scope legacy controls so newer calendar/engineering components keep their layouts. */
.iq-dashboard-shell .dashboard :is(input, select, textarea),
.confirm-dialog :is(input, select, textarea) {
  border: 1px solid var(--iq-line);
  background: var(--iq-surface);
  color: var(--iq-text);
  border-radius: 7px;
  font-size: 14px;
  font-weight: 400;
  min-width: 0;
  color-scheme: inherit;
}
.iq-dashboard-shell .dashboard :is(input, select):not([type=checkbox]), .confirm-dialog :is(input, select):not([type=checkbox]) { min-height: 44px; }
.iq-dashboard-shell .dashboard :is(input, select, textarea):focus,
.confirm-dialog :is(input, select, textarea):focus { border-color: var(--iq-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--iq-accent) 16%, transparent); }
.iq-dashboard-shell .dashboard input[type=checkbox], .confirm-dialog input[type=checkbox] { min-height: 18px; accent-color: var(--iq-accent); }
.iq-dashboard-shell .dashboard input::placeholder, .confirm-dialog input::placeholder { color: var(--iq-muted); opacity: 1; }
.iq-dashboard-shell .dashboard :is(.primary-button, .primary-link-button), .confirm-dialog .primary-button {
  min-height: 40px;
  border: 1px solid var(--iq-accent);
  border-radius: 7px;
  background: var(--iq-accent);
  color: var(--iq-accent-ink);
  font-size: 12px;
  font-weight: 650;
}
.iq-dashboard-shell .dashboard .ghost-button, .confirm-dialog .ghost-button { min-height: 40px; border-color: var(--iq-line); border-radius: 7px; background: var(--iq-surface); color: var(--iq-text); font-size: 12px; font-weight: 600; }
.iq-dashboard-shell .dashboard :is(.primary-button, .primary-link-button, .ghost-button):hover, .confirm-dialog :is(.primary-button, .ghost-button):hover { filter: none; box-shadow: inset 0 0 0 1px var(--iq-accent); }
.iq-dashboard-shell .dashboard .danger-button, .confirm-dialog .danger-button { color: var(--iq-danger); background: var(--app-danger-bg); border-color: color-mix(in srgb, var(--iq-danger) 35%, var(--iq-line)); font-size: 12px; font-weight: 600; }
.iq-dashboard-shell .dashboard button:disabled, .confirm-dialog button:disabled { opacity: .55; }
.iq-dashboard-shell :is(a, button, summary):focus-visible, .confirm-dialog :is(a, button):focus-visible { outline: 3px solid var(--iq-blue); outline-offset: 3px; }
.iq-dashboard-shell .form-message.error, .confirm-dialog .form-message.error { color: var(--iq-danger); }
.iq-dashboard-shell .support-message.admin { background: var(--iq-soft); border-color: var(--iq-line); }
.iq-dashboard-shell .support-message.internal { background: var(--app-warning-bg); border-color: var(--iq-line); }

/* These dialogs are siblings of #app-view, so they need their own theme scope. */
.confirm-dialog { color: var(--iq-text); color-scheme: light; }
[data-dashboard-theme=dark] .confirm-dialog { color-scheme: dark; }
.confirm-dialog::backdrop { background: #172a345c; backdrop-filter: blur(4px); }
.confirm-dialog-panel { background: var(--iq-surface); border: 1px solid var(--iq-line); box-shadow: var(--app-shadow); gap: 17px; }
.confirm-dialog h2 { font-size: 26px; font-weight: 650; letter-spacing: -.6px; }
.confirm-dialog :is(label, .confirm-dialog-copy, .form-message) { color: var(--iq-muted); font-size: 13px; font-weight: 500; }
.confirm-dialog .delete-warning { background: var(--app-warning-bg); border-color: color-mix(in srgb, var(--iq-orange) 30%, var(--iq-line)); }
.confirm-dialog .delete-warning strong { color: var(--iq-orange); font-weight: 650; }
.confirm-dialog .delete-warning span { color: var(--iq-text); font-weight: 400; }
.confirm-dialog .confirm-dialog-actions { flex-wrap: wrap; }

@media(max-width:1000px) {
  .iq-dashboard-shell :is(.project-band, .project-control-grid, .project-overview-grid, .scenario-band, .admin-grid) { grid-template-columns: minmax(0, 1fr); }
  .iq-dashboard-shell .product-dashboard-actions { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
}
@media(max-width:700px) {
  .iq-dashboard-shell .dashboard { padding: 25px 16px 36px; }
  .iq-dashboard-shell .dashboard h1 { font-size: 27px; }
  .iq-dashboard-shell .dashboard-head { align-items: start; }
  .iq-dashboard-shell .product-dashboard-card { min-height: 0; }
  .iq-dashboard-shell .scenario-row { align-items: stretch; flex-direction: column; }
  .iq-dashboard-shell .scenario-controls { flex-wrap: wrap; }
  .iq-dashboard-shell .dashboard :is(input, select, textarea), .confirm-dialog :is(input, select, textarea) { font-size: 16px; }
  .iq-dashboard-shell .admin-row { grid-template-columns: minmax(0, 1fr); }
  .iq-dashboard-shell .status-grid { grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); }
}
@media(prefers-reduced-motion:reduce) { .iq-dashboard-shell :is(.project-row, .support-ticket-row, .danger-button) { transition: none; } }
