/* Maritime Editorial Harbour surfaces. Layout and functional component geometry live in style.css. */
:root {
  color-scheme: light;
  --bg-space: #f4f1e8;
  --bg-midnight: #e2eef1;
  --bg: #f4f1e8;
  --bg2: #e9f1ef;
  --surface: #fffdf8;
  --surface2: #eef4f2;
  --surface3: #dcebf0;
  --line: #cbd9d8;
  --line2: #a3c0c9;
  --ink: #14384b;
  --ink2: #264857;
  --mute: #516a73;
  --dim: #627a82;
  --cyan: #176482;
  --cobalt: #1f6d87;
  --polar: #1e4d60;
  --mint: #366f5b;
  --warm: #9a6030;
  --brass: #b5783e;
  --danger: #a53d43;
  --danger-soft: #96343c;
  --font: 'Inter', 'Avenir Next', Avenir, -apple-system, BlinkMacSystemFont, sans-serif;
  --serif: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
}

.atmosphere {
  inset: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 65% 50% at 14% 28%, rgba(196, 224, 232, 0.65), transparent 60%),
    radial-gradient(ellipse 60% 55% at 88% 78%, rgba(168, 209, 220, 0.42), transparent 60%),
    radial-gradient(ellipse 50% 40% at 52% 8%, rgba(255, 253, 246, 0.85), transparent 70%),
    #f4f1e8;
  filter: none;
  transform: none;
  will-change: auto;
}

/* Subtle hydrographic latitude/longitude chart lines across the background */
.cockpit-grid-overlay {
  display: block;
  opacity: 0.55;
  background-image:
    linear-gradient(to right, rgba(23, 63, 84, 0.032) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(23, 63, 84, 0.032) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0.7) 25%, transparent 88%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0.7) 25%, transparent 88%);
}
.environment-vignette { display: none; }

.liquid-glass, .glass, .surface {
  background: #fffdf8;
  border: 1px solid var(--line);
  box-shadow:
    0 10px 28px -16px rgba(20, 56, 75, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Header & Brand */
#workspace-header {
  border-radius: 16px;
  background: linear-gradient(180deg, #fdfcf7 0%, #f6f8f3 100%);
  border: 1px solid #c4d5d7;
  box-shadow:
    0 1px 0 #ffffff inset,
    0 10px 24px -16px rgba(20, 56, 75, 0.20);
  flex-wrap: wrap;
  height: auto;
  min-height: 64px;
}

.hud-brand {
  border: 0;
  background: none;
  padding: 2px 4px;
  color: var(--ink);
  gap: 11px;
  transition: transform 0.2s ease;
}
.hud-brand:hover { transform: translateY(-1px); }

.brand-mark-wrap {
  width: 36px;
  height: 36px;
  border: 0;
  background: none;
  box-shadow: 0 3px 10px rgba(20, 56, 75, 0.14);
  border-radius: 50%;
}
.brand-mark-img { transform: none; }
.brand-word {
  font: 500 28px/1 var(--serif);
  letter-spacing: -0.025em;
  color: var(--ink);
}
.brand-tag { display: none; }

.hud-workspaces {
  background: #e7f0ef;
  border-color: #c2d4d6;
  max-width: 42vw;
  box-shadow: inset 0 1px 2px rgba(20, 56, 75, 0.06);
}
.hud-ws-pill { color: var(--mute); }
.hud-ws-pill.on, .hud-pill-btn.on {
  background: #fffdf9;
  color: var(--ink);
  border-color: #9abac6;
  box-shadow: 0 2px 6px rgba(20, 56, 75, 0.10);
}
.hud-ws-count { background: #d5e4e6; color: var(--ink2); }
.hud-ws-pill.on .hud-ws-count { background: #dceef3; color: var(--cyan); }
.hud-ws-count.hot { background: #b56c32; color: #fffdf8; }

.hud-pill-btn {
  border-color: var(--line);
  background: #fffdf8;
  color: var(--ink2);
}
.hud-pill-btn:hover, .hud-ws-pill:hover {
  background: #e4eff1;
  color: var(--ink);
}

.sidekick-toggle,
.sidekick-toggle:hover,
.sidekick-toggle[aria-expanded=true] {
  background: linear-gradient(180deg, #21617a 0%, #174c62 100%);
  color: #fffdf5;
  border-color: #154559;
  box-shadow: 0 3px 10px rgba(23, 76, 98, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

/* Main & Harbour Basin Overview */
#main { border-radius: 16px; }
#main[data-view="overview"] { overflow: hidden; }

.flight-deck-bar {
  padding: 8px 4px 18px;
  flex-wrap: wrap;
}
.flight-deck-title-group { display: block; }
.flight-deck-title {
  font: 500 35px/1.15 var(--serif);
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 5px;
}
.flight-deck-sub {
  font-size: 13.5px;
  color: var(--mute);
}

.flight-deck-scroll {
  padding: 22px 22px 32px;
  border: 1px solid #adc8d1;
  border-radius: 18px;
  background:
    linear-gradient(to right, rgba(23, 76, 101, 0.038) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(to bottom, rgba(23, 76, 101, 0.038) 1px, transparent 1px) 0 0 / 48px 48px,
    radial-gradient(ellipse at 12% 12%, rgba(255, 253, 245, 0.72), transparent 58%),
    linear-gradient(148deg, #cbe2e9 0%, #dfecea 62%, #c3dde6 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    inset 0 10px 28px -18px rgba(20, 56, 75, 0.18);
}

.mfd-grid {
  gap: 24px;
  grid-auto-rows: minmax(272px, auto);
}

/* Editorial Berth Tiles & 4-State Visual Hierarchy */
.agent-pane,
.agent-pane.state-nominal,
.agent-pane.state-unread,
.agent-pane.state-approval,
.agent-pane.state-error {
  border-radius: 14px;
  border: 1px solid #b5cad0;
  background: linear-gradient(140deg, #fffef9 28%, #edf4f4 100%);
  box-shadow:
    0 4px 0 #c6d9de,
    0 6px 0 #95b6c2,
    0 18px 32px -14px rgba(20, 62, 82, 0.25),
    inset 0 1px 0 #ffffff;
  min-width: 0;
  padding: 24px 26px;
  isolation: isolate;
}
.agent-pane:nth-child(3n+2) {
  background: linear-gradient(140deg, #fbfefe 24%, #e2f0f4 100%);
}
.agent-pane:nth-child(3n) {
  background: linear-gradient(140deg, #fffdf6 24%, #e9f2ee 100%);
}

/* Cursor-tracked warm sunlight & water-caustic reflection */
.agent-pane::before {
  display: block;
  background: radial-gradient(
    380px circle at var(--mx) var(--my),
    rgba(255, 252, 240, 0.75) 0%,
    rgba(23, 100, 130, 0.045) 42%,
    transparent 72%
  );
}

/* Top engraved signal rule per state */
.agent-pane::after {
  display: block;
  top: 0;
  left: 18px;
  right: 18px;
  height: 2.5px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, transparent, rgba(120, 152, 162, 0.45), transparent);
  box-shadow: none;
}

.agent-pane.state-unread {
  border-color: #7eb0c2;
  box-shadow:
    0 4px 0 #b8d4de,
    0 6px 0 #7da6b5,
    0 20px 34px -14px rgba(23, 100, 130, 0.28),
    inset 0 1px 0 #ffffff;
}
.agent-pane.state-unread::after {
  background: linear-gradient(90deg, transparent, #176482, #2b8cb0, #176482, transparent);
}

.agent-pane.state-approval {
  border-color: #c28b52;
  background: linear-gradient(140deg, #fffdf7 20%, #f8f0e0 100%);
  box-shadow:
    0 4px 0 #dfd0b8,
    0 6px 0 #b89872,
    0 20px 36px -14px rgba(152, 98, 57, 0.28),
    inset 0 1px 0 #ffffff;
}
.agent-pane.state-approval::after {
  left: 12px;
  right: 12px;
  height: 3px;
  background: linear-gradient(90deg, transparent, #b87333, #d9944e, #b87333, transparent);
}

.agent-pane.state-error {
  border-color: #be6b68;
  background: linear-gradient(140deg, #fffcf9 20%, #f7e9e6 100%);
  box-shadow:
    0 4px 0 #dfc3bf,
    0 6px 0 #b88c88,
    0 20px 36px -14px rgba(165, 61, 67, 0.25),
    inset 0 1px 0 #ffffff;
}
.agent-pane.state-error::after {
  background: linear-gradient(90deg, transparent, #a53d43, #cf5c62, #a53d43, transparent);
}

.agent-pane:hover {
  box-shadow:
    0 6px 0 #bfd6dc,
    0 8px 0 #8aafbd,
    0 26px 40px -14px rgba(20, 62, 82, 0.30),
    inset 0 1px 0 #ffffff;
}

.pane-title {
  font: 500 25px/1.18 var(--serif);
  letter-spacing: -0.02em;
  color: var(--ink);
}
.pane-top { flex-wrap: wrap; gap: 12px; }
.pane-identity { max-width: 100%; }
.pane-meta { flex-wrap: wrap; }
.pane-place {
  background: #e6efef;
  border-color: #c2d4d7;
  color: var(--ink2);
}
.bay-code {
  color: #5b7580;
  letter-spacing: 0.11em;
  margin-bottom: 6px;
}
.pane-narrative {
  font-weight: 400;
  color: var(--ink2);
  padding-right: 112px;
  margin-top: 18px;
  max-width: calc(100% - 20px);
}
.pane-footer {
  position: relative;
  z-index: 3;
  background: rgba(237, 243, 239, 0.88);
  border: 1px solid #c3d5d4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  backdrop-filter: none;
  gap: 10px;
  flex-wrap: wrap;
}
.deliverable-text { max-width: 300px; }
.deliverable-badge {
  background: #dde8e7;
  color: var(--ink);
}

.pane-cta {
  background: #fffdf7;
  color: var(--ink);
  border-color: #aac3cb;
  box-shadow: 0 1px 2px rgba(20, 56, 75, 0.08);
  transition: all 0.2s ease;
}
.agent-pane:hover .pane-cta {
  border-color: #176482;
  background: #f2f9fb;
}
.state-unread .pane-cta {
  background: #176482;
  color: #fffdf7;
  border-color: #14556e;
}
.state-approval .pane-cta {
  background: linear-gradient(180deg, #b36e30 0%, #965922 100%);
  color: #fffdf7;
  border-color: #824b1a;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(150, 89, 34, 0.26);
}
.state-error .pane-cta {
  background: #a53d43;
  color: #fffdf7;
  border-color: #8c2f35;
}

/* Engraved Harbour Vessel & Water Choreography */
.ship-scene {
  position: absolute;
  right: 16px;
  bottom: 74px;
  width: 158px;
  height: 86px;
  color: #3f7c94;
  pointer-events: none;
  z-index: 0;
  opacity: 0.90;
  overflow: visible;
}
.ship-scene .vessel { transform-origin: 90px 64px; }
.ship-scene .port,
.ship-scene .anchor { display: none; }
.ship-scene.docked .port,
.ship-scene.anchored .anchor { display: block; }

.ship-scene.anchored .vessel {
  animation: ship-anchor 5.6s ease-in-out infinite;
}
.ship-scene.anchored .beacon {
  animation: anchor-beacon 2.4s ease-in-out infinite;
}
.ship-scene.sailing .vessel {
  animation: ship-sail 4.8s ease-in-out infinite;
}
.ship-scene.sailing .pennant {
  transform-origin: 90px 15px;
  animation: pennant-flutter 1.8s ease-in-out infinite;
}
.ship-scene.sailing .wave-front {
  animation: ship-wake 3.4s ease-in-out infinite;
}
.ship-scene.sailing .wave-swell {
  animation: ship-swell 4.2s ease-in-out infinite;
}
.ship-scene.sailing .wake-trail {
  animation: wake-shimmer 2.6s ease-in-out infinite;
}

.agent-pane:hover .ship-scene *,
.agent-pane:focus .ship-scene * {
  animation-play-state: paused;
}

@keyframes ship-anchor {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-2.5px) rotate(1.1deg); }
}
@keyframes anchor-beacon {
  0%, 100% { opacity: 0.25; r: 2.2px; }
  50% { opacity: 0.95; r: 3.4px; }
}
@keyframes ship-sail {
  0%, 100% { transform: translate(0, 0) rotate(-1.8deg); }
  50% { transform: translate(3.5px, -3px) rotate(1.2deg); }
}
@keyframes pennant-flutter {
  0%, 100% { transform: skewY(0deg) scaleX(1); }
  50% { transform: skewY(-5deg) scaleX(0.9); }
}
@keyframes ship-wake {
  0%, 100% { transform: translateX(0); opacity: 0.55; }
  50% { transform: translateX(-6px); opacity: 0.95; }
}
@keyframes ship-swell {
  0%, 100% { transform: translateX(0); opacity: 0.4; }
  50% { transform: translateX(5px); opacity: 0.75; }
}
@keyframes wake-shimmer {
  0%, 100% { transform: translateX(0); opacity: 0.2; }
  50% { transform: translateX(-7px); opacity: 0.75; }
}

/* Status Pills & Signal Lamp Dots */
.status-pill.nominal {
  background: #e5eee8;
  color: #386452;
  border-color: #b5cbbd;
}
.status-pill.unread {
  background: #d9ecf3;
  color: #165873;
  border-color: #96c1d1;
}
.status-pill.approval {
  background: #f5e6cf;
  color: #7d4c22;
  border-color: #caa574;
  box-shadow: 0 2px 8px rgba(179, 110, 48, 0.15);
}
.status-pill.error {
  background: #f6e2de;
  color: #943538;
  border-color: #cfa09c;
  box-shadow: none;
}

.status-pill.unread .pulse-dot,
.status-pill.approval .pulse-dot,
.status-pill.error .pulse-dot {
  animation: signal-beacon 2.2s ease-in-out infinite;
}
@keyframes signal-beacon {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 currentColor; }
  50% { opacity: 0.55; transform: scale(0.88); box-shadow: 0 0 0 3px transparent; }
}

.state-legend {
  background: #fafbf6;
  border-color: var(--line);
  backdrop-filter: none;
}
.legend-dot {
  box-shadow: none !important;
  flex: none;
}
.legend-dot.nominal { background: #527a66; }
.legend-dot.unread { background: #1f7491; }
.legend-dot.approval {
  background: #b57338;
  padding: 0;
  border: 0;
  display: inline-block;
}
.legend-dot.error { background: #a84346; }

/* Nautical Instrument Orbs */
.orb {
  color: #1c5873;
  background: linear-gradient(145deg, #f5f9f9 0%, #e1eded 100%);
  border-color: #b4cacf;
  box-shadow: inset 0 1px 0 #ffffff, 0 2px 5px rgba(20, 56, 75, 0.08);
}
.orb.run {
  color: #156280;
  background: linear-gradient(145deg, #ebf6fa 0%, #d3e9f2 100%);
  border-color: #84b7c9;
}
.orb.wait {
  color: #855225;
  background: linear-gradient(145deg, #fcf4e6 0%, #f0dfc3 100%);
  border-color: #c9ab7d;
  box-shadow: inset 0 1px 0 #ffffff;
}
.orb.failed, .orb.blocked {
  color: #94383b;
  background: linear-gradient(145deg, #fbf0ed 0%, #f0dbd6 100%);
  border-color: #c99993;
}

/* Conversation, Artifacts & Pages */
.title, .hero h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.02em;
}
.main-head { background: #fbfcf7; }
.agent-artifacts-col { background: #f2f5ee; }
.artifact-file-card {
  background: #fffdf8;
  border-color: var(--line);
}
.artifact-file-card:hover, .artifact-file-card.on {
  background: #e2eff2;
  border-color: #9abec9;
}
.artifact-preview-box, .body pre, .tool, .cmd, .table, .dayline, .cap-hero, .policy, .gen-inline-meter, .handoff-node, .dayline .track-tip {
  background: #edf2ee;
  border-color: var(--line);
  color: var(--ink2);
}
.body code, .inline-code { background: #e4eeeb; }
.body pre code { background: none; }
.msg:has(.human) > div:last-child {
  background: #e6f0f2;
  border-color: #bdd5db;
}
.human {
  background: #d5e7eb;
  border-color: #a6c5ce;
}
.scroll { scrollbar-color: #9eb9c1 transparent; }

/* Handoff banner chart sweep */
.handoff-banner {
  background: linear-gradient(135deg, #e7f2f5 0%, #f5f2e6 100%);
  border-color: #9ec0cb;
}
.handoff-banner::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: beam-sweep 2.4s cubic-bezier(0.19, 1, 0.22, 1) 1 forwards;
}

/* Controls, Modals & Sidekick */
.btn, .cmd-chip, .setting-link, .template {
  background: #fffdf8;
  border-color: var(--line);
  box-shadow: 0 1px 2px rgba(20, 56, 75, 0.05);
}
.btn:hover, .cmd-chip:hover, .setting-link:hover, .template:hover {
  background: #e6f0f1;
  border-color: #96b9c4;
}
.btn.pri, .btn.warm, .btn.pri:hover, .btn.warm:hover, .send {
  background: linear-gradient(180deg, #21617a 0%, #174d63 100%);
  color: #fffdf5;
  border-color: #144357;
  box-shadow: 0 2px 8px rgba(23, 77, 99, 0.22);
}
.btn.danger {
  background: #f5e3df;
  color: #9c3841;
  border-color: #cc9996;
}
.approval, .gen-inline-card {
  background: linear-gradient(145deg, #fbf7ec 0%, #f2ebd9 100%);
  border-color: #c7b48f;
  box-shadow: 0 6px 20px -10px rgba(152, 98, 57, 0.18);
}
.approval.done { background: #edf2ed; box-shadow: none; }
.tr.head, .seg { background: #e0eae8; }
.seg button.on { background: #fffdf8; }

.modal {
  background: #fffdf8;
  border-color: var(--line);
  box-shadow: 0 24px 80px rgba(25, 60, 78, 0.26);
}
.modal::backdrop {
  background: rgba(24, 60, 78, 0.34);
  backdrop-filter: blur(4px);
}
.field input, .field textarea, .field select, .sidekick-compose textarea {
  background: #f8faf6;
  border-color: #abc4cc;
  color: var(--ink);
}
.toast {
  background: #1b566e;
  color: #fffdf5;
  border-color: #3b768e;
}

#command {
  background: #fffdf8;
  border-radius: 16px;
}
#sidekick {
  background: #fffdf8;
  border-color: #9bbcc7;
  box-shadow: 0 20px 65px rgba(22, 62, 83, 0.26);
  backdrop-filter: none;
  border-radius: 16px;
}
.sidekick-head {
  background: linear-gradient(180deg, #21617a 0%, #184e64 100%);
  color: #fffdf5;
}
.sidekick-head .sidekick-star,
.sidekick-head .sidekick-private { color: #e1f0f2; }
.sidekick-head .btn {
  color: #fffdf5;
  background: transparent;
  border-color: #87acbc;
}
.sidekick-message.user, .sidekick-action {
  background: #e5eff1;
  border-color: #b1ccd5;
}
.sidekick-context { background: #eef4f1; }
.m-dot.on, .dayline .track-now { box-shadow: none; }

@media (max-width: 980px) {
  .mfd-grid { grid-template-columns: 1fr; }
  .agent-cockpit-split { grid-template-columns: 1fr; }
  .agent-artifacts-col { max-height: 220px; }
  .hud-workspaces { max-width: 55vw; }
  .hud-actions { flex-wrap: wrap; margin-left: 0; }
}
@media (max-width: 600px) {
  #app { padding: 8px; gap: 10px; }
  #workspace-header { padding: 10px; gap: 8px; }
  .hud-brand { gap: 6px; }
  .brand-word { font-size: 23px; }
  .hud-workspaces { order: 3; max-width: none; flex-basis: 100%; }
  .hud-actions { order: 4; flex: 1; gap: 5px; }
  .hud-pill-btn { padding: 6px 9px; }
  .flight-deck-title { font-size: 28px; }
  .flight-deck-bar { gap: 10px; padding-bottom: 12px; }
  .flight-deck-scroll { padding: 12px 12px 24px; }
  .agent-pane { padding: 18px !important; }
  .pane-title { font-size: 22px; }
  .pane-narrative { padding-right: 76px; }
  .ship-scene { width: 112px; right: 10px; bottom: 88px; }
  .main-head { padding: 14px; flex-wrap: wrap; }
  .feed { padding: 16px; }
  .cap-hero, .grid2 { grid-template-columns: 1fr; }
  #sidekick { right: 8px; top: 18px; bottom: 12px; width: calc(100vw - 16px); }
  .agent-head .agent-heading { flex-wrap: wrap; gap: 8px; }
  .agent-head .title { font-size: 22px; }
  .agent-artifacts-col { max-height: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .ship-scene *, .pulse-dot, .handoff-banner::before { animation: none !important; }
  .agent-pane { transform: none !important; }
}

.modal .tr { min-width: 0; }
.subscription-table .tr { display: flex; flex-wrap: wrap; justify-content: space-between; min-width: 0; gap: 12px; }
.subscription-table .tr > div:first-child { flex: 1 1 200px; }
.subscription-table .btns { flex: 0 1 auto; }
.modal input, .modal textarea { max-width: 100%; min-width: 0; }
