:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
  background: var(--bg, #eef5fb);
  color: var(--text, #071126);
  --bg: #eef5fb;
  --surface: #ffffff;
  --surface-soft: #f6f9fd;
  --text: #071126;
  --title-color: #071126;
  --muted: #60718a;
  --line: #dce5f0;
  --primary: #2563eb;
  --accent: #14b8a6;
  --green: #16b981;
  --red: #d6453d;
  --shadow: 0 22px 58px rgba(16, 32, 58, .12);
  --side-width: 190px;
  --brand-logo-size: 74px;
  --brand-logo-font-size: 31px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 94% 4%, rgba(37, 99, 235, .12), transparent 24%),
    radial-gradient(circle at 1% 94%, rgba(20, 184, 166, .14), transparent 28%),
    var(--bg, #eef5fb);
  color: var(--text, #071126);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(16,32,58,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16,32,58,.035) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.35), transparent 70%);
}

h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: wait; opacity: .7; }

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 28px;
  border-radius: 26px;
  border: 1px solid rgba(255,255,255,.62);
  background: rgba(255,255,255,.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.auth-card h1 {
  font-size: 36px;
  line-height: 1;
}

.auth-form { display: grid; gap: 2px; margin-top: 18px; }
.auth-actions { display: grid; gap: 12px; margin-top: 6px; }
.auth-actions .wide { margin-bottom: 0; }

.app-shell {
  display: grid;
  grid-template-columns: var(--side-width) minmax(0, 1fr);
  min-height: 100vh;
}

.side-rail {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 100vh;
  padding: 24px 14px;
  background: #101a2d;
  border-right: 1px solid rgba(255,255,255,.08);
  transition: padding .18s ease;
  user-select: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  justify-items: center;
  text-align: center;
  width: min(100%, 116px);
  height: 54px;
  margin: 0 0 22px;
  padding: 0 12px;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--accent));
  box-shadow: 0 18px 38px rgba(20, 184, 166, .25);
  font-size: 24px;
  font-weight: 950;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.brand-mark.has-image {
  background: rgba(255,255,255,.08);
  padding: 8px;
}

.brand-mark img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  margin: auto;
}

.rail-toggle {
  width: min(100%, 116px);
  min-height: 38px;
  margin-bottom: 18px;
  border-radius: 12px;
  color: #d8e7ff;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  font-size: 11px;
  font-weight: 900;
}

.rail-toggle:hover {
  background: rgba(255,255,255,.13);
}

.side-rail nav { display: grid; gap: 10px; }

.nav-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  color: #9fb4d2;
  text-decoration: none;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, .14);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.rail-resize {
  position: absolute;
  top: 0;
  right: -5px;
  width: 10px;
  height: 100%;
  cursor: ew-resize;
}

.rail-resize::after {
  content: "";
  position: absolute;
  top: 22px;
  bottom: 22px;
  left: 4px;
  width: 2px;
  border-radius: 99px;
  background: transparent;
}

.side-rail:hover .rail-resize::after,
.side-rail.is-resizing .rail-resize::after {
  background: rgba(20,184,166,.8);
}

body.is-rail-resizing {
  cursor: ew-resize;
}

body.is-rail-resizing * {
  cursor: ew-resize !important;
}

/* Field Command visual system */
:root {
  --navy: #0b1526;
  --navy-soft: #142238;
  --orange: #f59e0b;
  --green-soft: #e9f8f2;
  --side-width: 236px;
  --shadow: 0 14px 38px rgba(15, 34, 59, .08);
}

body {
  background: #f3f6fa;
}

body::before { display: none; }

.app-shell { grid-template-columns: var(--side-width) minmax(0, 1fr); }

.side-rail {
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  background: var(--navy);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  margin-bottom: 24px;
}

.brand-mark {
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  margin: 0;
  padding: 5px;
  border-radius: 13px;
  background: rgba(255,255,255,.08);
  box-shadow: none;
  font-size: 19px;
}

.brand-mark.has-image { background: rgba(255,255,255,.92); padding: 5px; }
.brand-copy { display: grid; min-width: 0; color: #fff; }
.brand-copy strong { font-size: 16px; letter-spacing: .01em; }
.brand-copy span { margin-top: 2px; color: #8295b1; font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .11em; }
.rail-toggle { width: 100%; min-height: 34px; margin-bottom: 16px; color: #8ea2bd; background: transparent; border-color: #273650; }
.side-rail nav { gap: 5px; }
.nav-item { min-height: 48px; padding: 0 12px; border-radius: 10px; color: #9aabc1; }
.nav-item span { width: 27px; color: #536983; font-size: 10px; letter-spacing: .08em; }
.nav-item.active, .nav-item:hover { background: #1c2b42; box-shadow: inset 3px 0 var(--orange); }
.nav-item.active span { color: var(--orange); }
.rail-footer { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 14px 10px 2px; color: #71859f; font-size: 11px; font-weight: 700; }
.rail-live-dot { width: 7px; height: 7px; border-radius: 50%; background: #23c98a; box-shadow: 0 0 0 5px rgba(35,201,138,.1); }

.shell { width: min(1180px, calc(100% - 52px)); padding: 28px 0 44px; }
.topbar { margin-bottom: 24px; }
.eyebrow { display: block; margin-bottom: 7px; color: #6a7d95; font-size: 10px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow.light { color: rgba(255,255,255,.58); }
h1 { font-size: clamp(29px, 3vw, 42px); line-height: 1.04; letter-spacing: -.035em; }
.topbar p { margin-top: 7px; font-size: 13px; }
.top-actions { gap: 8px; }
.primary-action, .icon-button { min-height: 44px; border-radius: 11px; font-weight: 850; }
.primary-action { padding: 0 18px; color: #fff; background: var(--primary); box-shadow: 0 9px 22px rgba(37,99,235,.2); }
.icon-button { padding: 0 15px; color: #253750; background: #fff; border: 1px solid #dfe7f0; }
.tools-dropdown { border-radius: 12px; box-shadow: 0 18px 50px rgba(15,34,59,.16); }

.command-overview { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, .8fr); gap: 14px; margin-bottom: 14px; }
.command-card { min-height: 0; padding: 23px; border: 0; border-radius: 17px; background: linear-gradient(135deg, #10233a 0%, #12344d 58%, #145b64 100%); box-shadow: var(--shadow); }
.command-card::after { width: 230px; height: 230px; opacity: .38; }
.command-heading { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.command-card h2 { margin: 0; max-width: none; font-size: clamp(24px, 2.5vw, 34px); letter-spacing: -.025em; }
.automation-badge { flex: 0 0 auto; min-height: 36px; padding: 7px 11px; font-size: 11px; }
.status-orb { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 5px rgba(255,255,255,.08); }
.mini-metrics { margin-top: 25px; gap: 9px; }
.mini-metrics div { min-height: 78px; padding: 14px; border-radius: 12px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); }
.mini-metrics span { font-size: 9px; }
.mini-metrics strong { font-size: 13px; }
.command-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.command-actions span { color: rgba(255,255,255,.58); font-size: 11px; }
.pause-button { min-height: 39px; padding: 0 13px; border-radius: 10px; color: #fff; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.17); font-weight: 850; }
.pause-button.resume { color: #082619; background: #55d9a5; border-color: transparent; }

.status-column { gap: 14px; }
.live-run, .today-status { min-height: 0; padding: 18px; border-radius: 17px; background: #fff; border: 1px solid #e1e8f0; box-shadow: var(--shadow); }
.live-run strong, .today-status strong { color: #14233a; font-size: 14px; }
.live-run p, .today-status p { margin-top: 6px; color: #718198; font-size: 12px; line-height: 1.5; }
.today-status.paused { background: #fff7e7; border-color: #f6d68b; }

.panel { border-radius: 17px; border: 1px solid #e1e8f0; box-shadow: var(--shadow); }
.health-panel { margin-bottom: 14px; padding: 20px; }
.health-panel .section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.health-panel .section-head strong { color: #60718a; font-size: 12px; }
.health-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; margin-top: 15px; }
.health-item { padding: 13px; border-radius: 12px; background: #f7f9fc; border: 1px solid #e8edf3; }
.health-item-head { display: flex; align-items: center; gap: 7px; }
.health-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.health-item.healthy .health-dot { background: #1eb980; box-shadow: 0 0 0 4px rgba(30,185,128,.12); }
.health-item.error .health-dot { background: #e05a52; box-shadow: 0 0 0 4px rgba(224,90,82,.1); }
.health-item.paused .health-dot { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,.12); }
.health-item strong { color: #17263b; font-size: 12px; }
.health-item p { margin-top: 7px; color: #748399; font-size: 10px; line-height: 1.4; }

.settings-layout { gap: 14px; }
.quick-panel, .keywords-grid .panel, .log-panel { padding: 20px; }
.section-head h2 { font-size: 20px; letter-spacing: -.02em; }
.activity-feed { display: grid; gap: 8px; margin-top: 15px; }
.activity-item { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px 13px; border-radius: 11px; background: #f7f9fc; border: 1px solid #e8edf3; }
.activity-marker { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: #3b82f6; }
.activity-item.completed .activity-marker { background: #1eb980; }
.activity-item.error .activity-marker { background: #e05a52; }
.activity-item strong { color: #17263b; font-size: 12px; }
.activity-item p { margin-top: 3px; color: #748399; font-size: 11px; }
.activity-item time { color: #8b99ab; font-size: 9px; white-space: nowrap; }
.log-panel details { margin-top: 13px; }
.log-panel summary { cursor: pointer; color: #60718a; font-size: 11px; font-weight: 800; }

@media (max-width: 980px) {
  .app-shell { display: block; padding-bottom: 72px; }
  .side-rail { position: fixed; inset: auto 0 0 0; z-index: 50; display: block; width: 100%; height: 68px; padding: 8px 10px; border-top: 1px solid #273650; border-right: 0; }
  .brand-lockup, .rail-toggle, .rail-footer, .rail-resize { display: none; }
  .side-rail nav { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
  .nav-item { justify-content: center; min-height: 52px; padding: 0 5px; font-size: 11px; }
  .nav-item span { display: none; }
  .nav-item.active, .nav-item:hover { box-shadow: inset 0 -3px var(--orange); }
  .shell { width: min(100% - 28px, 760px); padding-top: 18px; }
  .command-overview { grid-template-columns: 1fr; }
  .health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .topbar { grid-template-columns: 1fr; gap: 14px; }
  .top-actions { display: grid; grid-template-columns: 1fr auto; }
  .primary-action { width: 100%; }
  .command-heading { display: grid; }
  .automation-badge { width: fit-content; }
  .mini-metrics { grid-template-columns: 1fr; }
  .mini-metrics div { min-height: 64px; }
  .command-actions { align-items: flex-start; flex-direction: column; }
  .health-grid { grid-template-columns: 1fr; }
  .activity-item { grid-template-columns: 10px minmax(0, 1fr); }
  .activity-item time { grid-column: 2; }
}

/* Mobile administration */
@media (max-width: 720px) {
  html, body { overflow-x: hidden; }
  button, input, select { min-height: 48px; }
  input, select, textarea { font-size: 16px; }
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal-panel { width: 100%; max-width: none; min-height: 100dvh; max-height: 100dvh; padding: 18px 14px calc(88px + env(safe-area-inset-bottom)); border-radius: 0; overflow-y: auto; }
  .modal-header { position: sticky; top: -18px; z-index: 2; padding: 14px 0; background: var(--surface, #fff); }
  .security-grid, .credentials-grid, .field-grid { grid-template-columns: 1fr; }
  .user-row, .user-row-actions, .user-form-actions, .modal-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .user-row-actions button, .user-form-actions button, .modal-actions button { width: 100%; }
  .top-actions { grid-template-columns: 1fr; }
  .tools-menu, .tools-dropdown { width: min(94vw, 360px); }
  .side-rail { padding-bottom: calc(8px + env(safe-area-inset-bottom)); height: calc(68px + env(safe-area-inset-bottom)); }
}

.shell {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: 30px 0 42px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  margin-bottom: 22px;
}

h1 {
  font-size: clamp(34px, 4.6vw, 58px);
  line-height: .96;
  color: var(--text, #071126);
}

.topbar p {
  max-width: 720px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tools-menu { position: relative; }

.ghost-button,
.secondary,
.primary,
.modal-close,
.eye-button,
.remove-time-button,
.add-time-button {
  min-height: 46px;
  border-radius: 14px;
  font-weight: 850;
  letter-spacing: 0;
}

.ghost-button {
  padding: 0 18px;
  color: #071126;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(16,32,58,.08);
}

.ghost-button:hover { background: #f4f8fc; }

.tools-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 30;
  width: 260px;
  padding: 8px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.tools-dropdown button {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  color: #071126;
  background: transparent;
  text-align: left;
  font-weight: 850;
}

.tools-dropdown button:hover { background: #f4f8fc; }

.secondary {
  padding: 0 20px;
  color: #031014;
  background: linear-gradient(135deg, #67e8f9, var(--accent));
  box-shadow: 0 16px 36px rgba(20, 184, 166, .25);
}

.primary {
  width: 100%;
  padding: 0 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  box-shadow: 0 14px 34px rgba(37, 99, 235, .22);
}

.secondary:hover,
.primary:hover { filter: brightness(1.06); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .85fr);
  gap: 18px;
  margin-bottom: 18px;
}

.command-card {
  position: relative;
  overflow: hidden;
  min-height: 310px;
  padding: 26px;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,.45);
  background: linear-gradient(135deg, #0f7b70 0%, #11767c 42%, #2563eb 100%);
  box-shadow: var(--shadow);
}

.command-card::after {
  content: "";
  position: absolute;
  right: -46px;
  top: -60px;
  width: 270px;
  height: 270px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255,255,255,.22), transparent 58%),
    radial-gradient(circle at 30% 70%, rgba(103,232,249,.28), transparent 50%);
}

.command-card h2 {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin-top: 46px;
  color: #fff;
  font-size: clamp(30px, 3.2vw, 48px);
  line-height: 1;
}

.command-card p {
  position: relative;
  z-index: 1;
  max-width: 590px;
  margin-top: 14px;
  color: rgba(255,255,255,.82);
  font-size: 15px;
  line-height: 1.6;
}

.automation-badge {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 13px;
  border-radius: 999px;
  color: #eafffb;
  background: rgba(255,255,255,.13);
  border: 1px solid rgba(255,255,255,.25);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.automation-badge.is-running {
  color: #ddfff8;
  background: rgba(33, 211, 155, .16);
}

.automation-badge.is-stopped {
  color: #ffe2de;
  background: rgba(214, 69, 61, .16);
}

.clock {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
  position: relative;
}

.clock::before,
.clock::after {
  content: "";
  position: absolute;
  left: 7px;
  bottom: 7px;
  width: 2px;
  border-radius: 2px;
  background: currentColor;
  transform-origin: bottom center;
}

.clock::before { height: 6px; transform: rotate(35deg); }
.clock::after { height: 4px; transform: rotate(120deg); }
.automation-badge.is-running .clock::before { animation: tick 1.8s linear infinite; }
@keyframes tick { to { transform: rotate(395deg); } }

.mini-metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 32px;
}

.mini-metrics div {
  min-height: 94px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.24);
}

.mini-metrics span,
.section-head span,
.modal-header span {
  display: block;
  color: var(--accent);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.mini-metrics span { color: #aefef4; }

.mini-metrics strong {
  display: block;
  color: #fff;
  font-size: 18px;
  line-height: 1.24;
}

.status-column { display: grid; gap: 18px; }

.live-run,
.today-status,
.panel {
  border: 1px solid var(--line);
  background: var(--surface, #fff);
  box-shadow: var(--shadow);
}

.live-run,
.today-status {
  min-height: 146px;
  border-radius: 22px;
  padding: 22px;
}

.live-run {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.live-run strong,
.today-status strong {
  display: block;
  color: var(--text, #071126);
  font-size: 18px;
  line-height: 1.25;
}

.live-run p,
.today-status p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.live-dot {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin-top: 3px;
  border-radius: 50%;
  background: #9fb0c4;
  box-shadow: 0 0 0 7px rgba(96,113,138,.12);
}

.live-run.running,
.live-run.success,
.today-status.completed,
.today-status.ready {
  border-color: rgba(22, 185, 129, .35);
  background: #f0fffa;
}

.live-run.running .live-dot,
.live-run.success .live-dot {
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(22,185,129,.15);
}

.live-run.error,
.today-status.missed {
  border-color: rgba(214, 69, 61, .36);
  background: #fff5f4;
}

.live-run.error .live-dot {
  background: var(--red);
  box-shadow: 0 0 0 7px rgba(214,69,61,.15);
}

.settings-layout {
  display: grid;
  grid-template-columns: minmax(330px, .86fr) minmax(0, 1.14fr);
  gap: 18px;
}

.panel {
  border-radius: 22px;
  padding: 22px;
}

.quick-panel { grid-row: span 2; }
.section-head { margin-bottom: 18px; }

.section-head h2,
.modal-header h2 {
  color: var(--text, #071126);
  font-size: 22px;
  line-height: 1.1;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: #17243a;
  font-size: 13px;
  font-weight: 850;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

input[type="time"],
input[type="number"],
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
  background: #f8fbff;
  color: var(--text, #071126);
  outline: none;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 12px) 21px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(20, 184, 166, .72);
  box-shadow: 0 0 0 4px rgba(20, 184, 166, .12);
}

textarea {
  min-height: 302px;
  resize: vertical;
  line-height: 1.5;
}

.time-list { display: grid; gap: 9px; }

.time-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

.remove-time-button,
.add-time-button,
.eye-button,
.modal-close {
  padding: 0 13px;
  border: 1px solid var(--line);
  color: #071126;
  background: #f8fbff;
}

.add-time-button { width: 100%; }
.remove-time-button:hover,
.add-time-button:hover,
.eye-button:hover,
.modal-close:hover { background: #eef5fb; }

.checks {
  display: grid;
  gap: 10px;
  margin: 8px 0 18px;
  padding: 14px;
  border-radius: 18px;
  background: #f6f9fd;
  border: 1px solid var(--line);
}

.checks label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #263650;
}

.checks input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.keywords-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.ignore-panel textarea { min-height: 150px; }

.save-row,
.log-panel { grid-column: 1 / -1; }
.save-row { display: grid; }

pre {
  min-height: 178px;
  margin: 0;
  padding: 16px;
  white-space: pre-wrap;
  color: #263650;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.55;
}

.status {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--green);
  font-weight: 900;
}
.status.error { color: var(--red); }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 17, 31, .62);
  backdrop-filter: blur(12px);
}

.modal-overlay > .modal-panel { display: none !important; }
.modal-overlay > .modal-panel.is-open { display: block !important; }
body.modal-open { overflow: hidden; }

.modal-panel {
  width: min(1060px, 100%);
  max-height: min(790px, calc(100vh - 48px));
  overflow: auto;
  border-radius: 26px;
  padding: 24px;
  color: var(--text, #071126);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 36px 90px rgba(0,0,0,.26);
}

.load-error {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #f1b8b2;
  border-radius: 14px;
  color: #8f261f;
  background: #fff3f2;
  font-weight: 800;
}
.load-error button { min-height: 42px; border-radius: 11px; color: #fff; background: #b42318; font-weight: 900; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.hint {
  margin: -6px 0 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.secure-box {
  padding: 18px;
  border-radius: 22px;
  background: #f6f9fd;
  border: 1px solid var(--line);
}

.credentials-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.credentials-grid section {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #f8fbff;
}

.credentials-grid h3 {
  margin-bottom: 14px;
  color: var(--text, #071126);
  font-size: 16px;
}

.security-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, .86fr);
  gap: 16px;
}

.security-grid section {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #f8fbff;
}

.security-grid h3 {
  margin-bottom: 14px;
  font-size: 16px;
}

.users-list {
  display: grid;
  gap: 10px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.user-row.is-disabled { opacity: .62; }
.user-row-copy { display: grid; gap: 5px; min-width: 0; }
.user-row-actions { display: flex; gap: 7px; }
.user-row-actions button {
  min-height: 36px;
  padding: 0 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: #17243a;
  background: #fff;
  font-weight: 800;
}
.user-row-actions button[data-user-delete] { color: #b42318; }
.user-row-actions button:disabled { cursor: not-allowed; opacity: .38; }
.user-form-actions { display: grid; gap: 10px; }
.user-form-actions .wide { margin-bottom: 0; }
.edit-active-row { margin: 4px 0 14px; }
.user-form-status { min-height: 20px; margin-top: 10px; }
.user-form-status.error { color: #b42318; }

/* Final alignment pass: stable navigation dimensions and balanced spacing. */
:root { --side-width: 260px; }
.rail-toggle,
.rail-resize { display: none !important; }
.side-rail { padding-left: 24px; padding-right: 24px; }
.side-rail nav { width: 100%; }
.nav-item { width: 100%; gap: 12px; }
.nav-item span { width: 28px; flex: 0 0 28px; text-align: center; }
.rail-footer { justify-content: center; padding-left: 0; padding-right: 0; }

@media (max-width: 760px) {
  .user-row { grid-template-columns: 1fr; }
  .user-row-actions { width: 100%; }
  .user-row-actions button { flex: 1; }
}

.user-row strong {
  color: var(--text);
  font-size: 14px;
}

.user-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.secret-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.secret-field input { min-width: 0; }

.unlock-status {
  margin-bottom: 14px;
  color: var(--green);
  font-weight: 950;
}
.wide {
  width: 100%;
  margin-bottom: 14px;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.modal-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.modal-actions .primary {
  width: 100%;
}

.logo-uploader {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #f8fbff;
}

.logo-preview {
  display: grid;
  place-items: center;
  width: 120px;
  height: 120px;
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary), var(--accent));
  font-size: var(--brand-logo-font-size);
  font-weight: 950;
  overflow: hidden;
}

.logo-preview.has-image {
  padding: 10px;
  background: #10182b;
}

.logo-preview img {
  display: block;
  max-width: 100%;
  max-height: var(--brand-logo-size);
  width: auto;
  height: auto;
  object-fit: contain;
  margin: auto;
}

input[type="color"] {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 5px;
  background: #f8fbff;
}

@media (max-width: 1020px) {
  .app-shell { grid-template-columns: 1fr; }
  .side-rail {
    position: static;
    height: auto;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
  }
  .brand-mark {
    width: 46px;
    height: 46px;
    margin: 0;
  }
  .rail-toggle,
  .rail-resize {
    display: none;
  }
  .side-rail nav {
    display: flex;
    gap: 8px;
    overflow: auto;
  }
  .nav-item { min-width: 86px; }
  .hero-grid,
  .settings-layout { grid-template-columns: 1fr; }
  .quick-panel { grid-row: auto; }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 28px, 1240px);
    padding-top: 22px;
  }
  .topbar,
  .top-actions,
  .mini-metrics,
  .keywords-grid,
  .field-grid,
  .credentials-grid,
  .color-grid {
    display: grid;
    grid-template-columns: 1fr;
  }
  .top-actions { gap: 10px; }
  .ghost-button,
  .secondary { width: 100%; }
  .tools-dropdown {
    left: 0;
    right: auto;
    width: min(280px, calc(100vw - 28px));
  }
  .command-card {
    min-height: auto;
    padding: 22px;
  }
  .command-card h2 { margin-top: 38px; }
  .modal-overlay { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .automation-badge.is-running .clock::before { animation: none; }
}

/* Compact sidebar brand lockup. */
.side-rail .brand-mark {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 64px !important;
  width: 64px !important;
  max-width: 64px !important;
  height: 64px !important;
  min-height: 64px !important;
  margin: 0 !important;
  padding: 5px !important;
  text-align: center !important;
  line-height: 1.12 !important;
  border-radius: 16px !important;
  background: rgba(255,255,255,.08) !important;
  position: relative !important;
  white-space: normal !important;
  overflow: hidden !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  font-size: var(--brand-logo-font-size) !important;
}

.side-rail .brand-mark::after {
  content: "" !important;
  display: none !important;
}

.side-rail .brand-mark img {
  display: block !important;
  max-width: none !important;
  max-height: none !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  margin: auto !important;
  transform: scale(var(--brand-logo-scale, 1)) !important;
  transform-origin: center !important;
}

.logo-preview img {
  transform: scale(var(--brand-logo-scale, 1));
  transform-origin: center;
}

.command-card .automation-badge {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 42px !important;
  margin: 0 auto 18px !important;
  padding: 0 14px !important;
  text-align: center !important;
  line-height: 1.15 !important;
  border-radius: 999px !important;
  white-space: normal !important;
  overflow: visible !important;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
}

.command-card .automation-badge span {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 100% !important;
  line-height: 1 !important;
  text-align: center !important;
}

.command-card .automation-badge .clock {
  display: none !important;
}

/* Concept-match layout: closer to the approved iOS/Android service dashboard mockup. */
@media (min-width: 1021px) {
  :root {
    --side-width: 244px;
  }

  body {
    padding: 44px 52px;
    background:
      radial-gradient(circle at 92% 4%, rgba(37, 99, 235, .12), transparent 26%),
      radial-gradient(circle at 0% 100%, rgba(20, 184, 166, .16), transparent 28%),
      #eef5fb;
  }

  body::before {
    opacity: .75;
  }

  .app-shell {
    width: min(1388px, 100%);
    min-height: calc(100vh - 88px);
    margin: 0 auto;
    padding: 30px;
    grid-template-columns: var(--side-width) minmax(0, 1fr);
    gap: 32px;
    border-radius: 40px;
    background: #fff;
    box-shadow: 0 30px 70px rgba(16, 32, 58, .14);
  }

  .side-rail {
    position: sticky;
    top: 44px;
    min-height: calc(100vh - 148px);
    height: auto;
    align-self: stretch;
    padding: 38px 30px;
    border: 0;
    border-radius: 30px;
    background: #10182b;
  }

  .brand-mark {
    width: 128px;
    height: 72px;
    min-height: 72px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 20px;
    background: rgba(255,255,255,.08);
    box-shadow: none;
    font-size: 26px;
    text-align: center;
  }

  .brand-mark.has-image {
    width: 128px;
    height: 72px;
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
  }

  .brand-mark img {
    max-width: 108px;
    max-height: 52px;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: auto;
  }

  .brand-mark::after {
    content: "Service Command";
    display: block;
    position: absolute;
    top: 122px;
    left: 30px;
    right: 30px;
    margin: 0;
    text-align: center;
    color: #9dbbf2;
    font-size: 13px;
    font-weight: 750;
  }

  .brand-mark.has-image::after {
    display: none;
  }

  .rail-toggle {
    width: 100%;
    margin: 34px 0 16px;
    color: #d9e8ff;
    text-align: left;
    padding: 0 16px;
  }

  .side-rail nav {
    gap: 14px;
  }

  .nav-item {
    min-height: 48px;
    padding: 0 18px;
    font-size: 15px;
    border-radius: 14px;
  }

  .nav-item.active::before {
    content: "";
    width: 14px;
    height: 14px;
    margin-right: 14px;
    border-radius: 50%;
    background: #34d399;
    flex: 0 0 auto;
  }

  .shell {
    width: 100%;
    padding: 8px 26px 26px 0;
  }

  .topbar {
    min-height: 190px;
    margin-bottom: 32px;
    padding: 30px 46px;
    align-items: center;
    border-radius: 30px;
    background: linear-gradient(135deg, #0d7c70 0%, #0d797b 48%, #2468e8 100%);
    box-shadow: 0 26px 55px rgba(29, 78, 216, .18);
  }

  .topbar h1 {
    color: #fff;
    font-size: clamp(38px, 4vw, 58px);
    text-shadow: 0 2px 0 rgba(0,0,0,.12);
  }

  .topbar p {
    color: rgba(255,255,255,.9);
    font-size: 16px;
    font-weight: 750;
  }

  .top-actions {
    align-self: center;
  }

  .topbar .ghost-button {
    color: #fff;
    background: rgba(255,255,255,.18);
    border-color: rgba(255,255,255,.18);
    box-shadow: none;
  }

  .topbar .secondary {
    min-width: 176px;
    color: #071126;
    background: #fff;
    box-shadow: none;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    margin-bottom: 32px;
  }

  .command-card,
  .live-run,
  .today-status {
    min-height: 154px;
    border-radius: 28px;
    background: #fff;
    border: 1px solid #edf1f6;
    box-shadow: 0 18px 42px rgba(16, 32, 58, .09);
  }

  .command-card {
    grid-column: 1 / -1;
    padding: 28px 34px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, .72fr);
    column-gap: 24px;
    align-items: center;
  }

  .command-card::after,
  .command-card p {
    display: none;
  }

  .command-card h2 {
    margin: 0;
    color: #071126;
    font-size: clamp(28px, 2.2vw, 36px);
    line-height: 1.08;
    max-width: 100%;
    overflow-wrap: normal;
    word-break: normal;
  }

  .automation-badge {
    color: #60718a;
    display: flex;
    width: max-content;
    min-width: 194px;
    height: 36px;
    min-height: 36px;
    margin: 0 auto 18px;
    padding: 0 12px;
    background: #f4f7fb;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-align: center;
  }

  .automation-badge span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    line-height: 1;
  }

  .automation-badge.is-running,
  .automation-badge.is-stopped {
    color: #60718a;
    background: #f4f7fb;
  }

  .automation-badge .clock {
    display: none;
  }

  .mini-metrics {
    display: block;
    margin-top: 0;
  }

  .mini-metrics div {
    display: none;
  }

  .mini-metrics div:first-child {
    display: block;
    min-height: auto;
    padding: 18px;
    background: #f7faff;
    border: 0;
    border-radius: 18px;
  }

  .mini-metrics span {
    color: #60718a;
  }

  .mini-metrics strong {
    color: #071126;
  }

  .status-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-column: 1 / -1;
    gap: 24px;
  }

  .live-run,
  .today-status {
    min-width: 0;
    padding: 30px 34px;
  }

  .live-run {
    display: block;
  }

  .live-dot {
    display: none;
  }

  .settings-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, .9fr);
    gap: 30px;
  }

  .quick-panel {
    grid-row: auto;
  }

  .panel {
    border-radius: 28px;
    border-color: #edf1f6;
    box-shadow: 0 18px 42px rgba(16, 32, 58, .08);
  }

  .keywords-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (min-width: 1021px) and (max-width: 1320px) {
  .app-shell {
    gap: 24px;
    padding: 24px;
  }

  .shell {
    padding-right: 12px;
  }

  .command-card {
    grid-template-columns: 1fr;
    row-gap: 16px;
  }

  .command-card h2 {
    text-align: center;
  }

  .status-column,
  .settings-layout {
    grid-template-columns: 1fr;
  }
}

/* Final Field Command overrides */
.app-shell { display: grid; grid-template-columns: var(--side-width) minmax(0, 1fr); gap: 0; padding: 0; }
.side-rail { position: sticky; top: 0; width: auto; height: 100vh; border-radius: 0; box-shadow: none; }
.shell { width: min(1180px, calc(100% - 52px)); max-width: none; margin: 0 auto; padding: 28px 0 44px; }
.topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 22px; margin-bottom: 24px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.topbar h1 { color: var(--title-color, var(--text, #071126)); font-size: clamp(29px, 3vw, 42px); text-align: left; text-shadow: none; }
.topbar p { display: block; }
.command-overview { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, .8fr); gap: 14px; margin-bottom: 14px; }
.command-card { display: block; min-height: 0; padding: 23px; border-radius: 17px; background: linear-gradient(135deg, #10233a 0%, #12344d 58%, #145b64 100%); }
.command-card h2 { margin: 0; color: #fff; text-align: left; }
.mini-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 25px; }
.mini-metrics div, .mini-metrics div:first-child { display: block; min-height: 78px; padding: 14px; border-radius: 12px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); }
.mini-metrics span { color: rgba(255,255,255,.6); }
.mini-metrics strong { color: #fff; }
.mini-metrics .metric-card {
  position: relative;
  min-width: 0;
  height: 78px;
  min-height: 78px;
  outline: none;
}
.mini-metrics .metric-card strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.mini-metrics .metric-card::after {
  content: attr(data-preview);
  position: absolute;
  z-index: 80;
  left: 50%;
  bottom: calc(100% + 10px);
  width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid #dce5f0;
  border-radius: 12px;
  color: #14233a;
  background: #fff;
  box-shadow: 0 18px 44px rgba(7,17,38,.24);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}
.mini-metrics .metric-card:hover::after,
.mini-metrics .metric-card:focus::after,
.mini-metrics .metric-card:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
.mini-metrics .metric-card:focus-visible {
  border-color: rgba(174,254,244,.8);
  box-shadow: 0 0 0 3px rgba(174,254,244,.18);
}
.status-column { display: grid; grid-template-columns: 1fr; grid-column: auto; gap: 14px; }
.live-run, .today-status { padding: 18px; border-radius: 17px; }
.settings-layout { grid-template-columns: 1fr; gap: 14px; }
.keywords-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.panel { border-radius: 17px; border-color: #e1e8f0; box-shadow: var(--shadow); }

@media (max-width: 980px) {
  .app-shell { display: block; padding: 0 0 72px; }
  .side-rail { position: fixed; inset: auto 0 0 0; z-index: 50; display: block; width: 100%; height: 68px; padding: 8px 10px; border-radius: 0; }
  .brand-lockup, .rail-toggle, .rail-footer, .rail-resize { display: none; }
  .side-rail nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .nav-item { justify-content: center; min-height: 52px; padding: 0 5px; font-size: 11px; }
  .nav-item span { display: none; }
  .shell { width: min(100% - 28px, 760px); margin: 0 auto; padding: 18px 0 36px; }
  .topbar { grid-template-columns: 1fr; }
  .command-overview { grid-template-columns: 1fr; }
  .health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-layout, .keywords-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .top-actions { display: grid; grid-template-columns: 1fr auto; }
  .command-heading { display: grid; }
  .mini-metrics { grid-template-columns: 1fr; }
  .health-grid { grid-template-columns: 1fr; }
}

/* Prompts tool */
.prompts-page { display: grid; gap: 14px; }
.prompts-page-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.prompts-page-head h2 { margin-top: 4px; font-size: 30px; line-height: 1.1; }
.prompts-page-head p { margin-top: 7px; color: var(--muted); font-size: 13px; }
.prompts-back { min-height: 42px; padding: 0 15px; color: var(--primary); background: #fff; border: 1px solid var(--primary); border-radius: 10px; font-weight: 850; }
.prompts-editor-panel { padding: 20px; }
.prompts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.prompts-grid label { margin: 0; }
.prompts-grid textarea { min-height: 350px; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 13px; line-height: 1.55; }
.prompts-actions { display: flex; gap: 10px; margin-top: 16px; }
.prompts-actions .primary,
.prompts-actions .secondary { width: auto; min-width: 120px; min-height: 44px; border-radius: 11px; }
.prompts-actions .secondary { color: var(--primary); background: #fff; border: 1px solid var(--primary); box-shadow: none; }
.prompt-results-panel { padding: 20px; }
.prompt-results-empty { color: var(--muted); font-size: 13px; line-height: 1.55; }
.prompt-results { display: grid; gap: 12px; }
.prompt-test-summary { padding: 12px 14px; border: 1px solid rgba(22,185,129,.28); border-radius: 11px; color: #08704a; background: #f0fffa; font-size: 13px; font-weight: 800; }
.prompt-result-item { padding: 15px; border: 1px solid #e1e8f0; border-radius: 12px; background: #f8fbff; }
.prompt-result-item.would-send { border-left: 4px solid var(--primary); }
.prompt-result-item.ignored { border-left: 4px solid #94a3b8; }
.prompt-result-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid #e1e8f0; }
.prompt-result-heading strong { min-width: 0; overflow-wrap: anywhere; }
.prompt-result-heading span { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; color: #0d5f54; background: #e6faf5; font-size: 11px; font-weight: 900; }
.prompt-result-item.ignored .prompt-result-heading span { color: #52647c; background: #edf2f7; }
.prompt-result-item dl { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 7px 12px; margin: 14px 0 0; font-size: 13px; line-height: 1.45; }
.prompt-result-item dt { color: #52647c; font-weight: 850; }
.prompt-result-item dd { min-width: 0; margin: 0; color: #17243a; overflow-wrap: anywhere; }
.prompt-message-label { display: block; margin-top: 16px; font-size: 13px; }
.prompt-message-output { min-height: 0; margin-top: 8px; padding: 13px; border-radius: 10px; background: #fff; font-size: 13px; }
.prompt-digest-output { border: 1px solid rgba(37,99,235,.24); background: #f8fbff; white-space: pre-wrap; overflow-wrap: anywhere; }
.prompt-report-link { display: inline-flex; width: fit-content; padding: 10px 14px; border-radius: 8px; color: #fff; background: #101a2d; font-weight: 850; text-decoration: none; }

/* Reports */
.reports-page { display: grid; min-width: 0; gap: 14px; }
.reports-page-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.reports-page-head h2 { margin: 4px 0 0; font-size: 30px; line-height: 1.1; }
.reports-page-head p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.report-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.report-metrics article { min-width: 0; padding: 17px; border: 1px solid #e1e8f0; border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.report-metrics span { display: block; color: #6a7890; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.report-metrics strong { display: block; margin-top: 8px; overflow: hidden; color: #14233a; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.latest-report-panel { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 20px; padding: 20px; border-left: 4px solid #f59e0b; }
.latest-report-copy { min-width: 0; }
.latest-report-copy h3 { margin: 7px 0 4px; font-size: 20px; }
.latest-report-copy p { margin: 0; color: var(--muted); }
.report-state { display: inline-block; padding: 4px 7px; border-radius: 4px; color: #08704a; background: #e8fbf4; font-size: 10px; font-weight: 900; }
.report-actions,.table-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.report-actions .primary,.report-actions .secondary,.danger-button { display: inline-flex; align-items: center; justify-content: center; width: auto; height: 40px; margin: 0; padding: 0 13px; border-radius: 7px; box-sizing: border-box; line-height: 1; text-decoration: none; font-weight: 850; }
.danger-button { color: #9d2530; background: #fff; border: 1px solid #e7bbc0; }
.report-list-panel,.report-storage-panel { padding: 20px; }
.report-table-wrap { overflow-x: auto; }
.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table th,.report-table td { padding: 13px 10px; border-bottom: 1px solid #e6ebf2; text-align: left; white-space: nowrap; }
.report-table th { color: #6a7890; font-size: 10px; text-transform: uppercase; }
.table-state { padding: 4px 7px; border-radius: 4px; color: #08704a; background: #e8fbf4; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.table-actions a,.table-actions button { display: inline-flex; align-items: center; justify-content: center; width: auto; height: 32px; margin: 0; padding: 0 9px; border: 0; box-sizing: border-box; color: #31506f; background: #edf2f7; border-radius: 5px; font-size: 11px; font-weight: 800; line-height: 1; text-decoration: none; }
.report-storage-panel { display: grid; min-width: 0; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.2fr); gap: 24px; align-items: end; }
.report-storage-panel h2 { margin: 5px 0; }
.report-storage-panel p { margin: 0; color: var(--muted); }
#reportSettingsForm { display: grid; min-width: 0; grid-template-columns: minmax(100px, 130px) minmax(220px, 1fr); gap: 10px; align-items: end; }
#reportSettingsForm label { margin: 0; }
.report-settings-actions { display: flex; grid-column: 1 / -1; flex-wrap: wrap; gap: 10px; }
#reportSettingsForm button { width: auto; height: 42px; margin: 0; white-space: nowrap; }

@media (max-width: 980px) {
  .prompts-grid { grid-template-columns: 1fr; }
  .prompts-grid textarea { min-height: 250px; }
  .report-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-storage-panel { grid-template-columns: 1fr; }
  #reportSettingsForm { grid-template-columns: minmax(100px, 130px) minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .prompts-page-head { align-items: flex-start; }
  .prompts-back { flex: 0 0 auto; }
  .prompts-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .prompts-actions .primary,
  .prompts-actions .secondary { width: 100%; min-width: 0; }
  .prompt-result-heading { align-items: flex-start; }
  .prompt-result-item dl { grid-template-columns: 1fr; gap: 3px; }
  .prompt-result-item dd { margin-bottom: 8px; }
  .reports-page-head,.latest-report-panel { align-items: flex-start; }
  .reports-page-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .latest-report-panel { display: grid; }
  .report-metrics { grid-template-columns: 1fr; }
  .report-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .report-actions .primary,.report-actions .secondary,.danger-button { width: 100%; min-width: 0; }
  #reportSettingsForm { grid-template-columns: 1fr; }
  .report-settings-actions { grid-column: 1; }
}

@media (max-width: 420px) {
  .side-rail nav { gap: 0; }
  .nav-item { min-width: 0; padding: 0 2px; font-size: 9px; }
  .reports-page-head { grid-template-columns: 1fr; }
  .reports-page-head .prompts-back { width: fit-content; }
}
