:root {
  --atlantic: #0D2B33;
  --atlantic-2: #133944;
  --sand: #BCA47A;
  --sand-deep: #9C8457;
  --foam: #EEF3F1;
  --paper: #FFFFFF;
  --indian: #1E8C88;
  --ink: #16232A;
  --ink-2: #4A5B62;
  --line: #D3DEDA;
  --alert: #B4432F;
  --radius-s: 6px;
  --radius-l: 14px;
  --font: "Archivo", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-variation-settings: "wdth" 100;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--foam);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--indian); outline-offset: 2px; }

.btn-sand {
  background: var(--sand); color: var(--atlantic); border: 0; border-radius: var(--radius-s);
  padding: .7rem 1.2rem; font-weight: 700; font-variation-settings: "wdth" 112;
}
.btn-sand:hover { background: #C9B48D; }
.btn-sand:disabled { opacity: .5; cursor: default; }
.btn-line {
  background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: .55rem 1rem; font-weight: 600;
}
.link { background: none; border: 0; color: inherit; padding: .25rem 0; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* ---------- Gate: the one bold moment, two oceans meeting ---------- */
.gate { position: fixed; inset: 0; display: grid; place-items: center; background: var(--atlantic); overflow: hidden; }
.gate-sea { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; }
.gate-sea .atl { background: linear-gradient(180deg, #0B2730 0%, #0D2B33 55%, #10353F 100%); }
.gate-sea .ind { background: linear-gradient(180deg, #0F3A3D 0%, #145552 55%, #1A6C67 100%); }
@media (prefers-reduced-motion: no-preference) {
  .gate-sea .ind { animation: tide 1.4s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes tide { from { transform: translateX(100%); } to { transform: none; } }
}
.gate-card { position: relative; width: min(400px, calc(100vw - 32px)); color: var(--foam); }
.gate-logo { width: 220px; height: auto; display: block; }
.gate-title { font-size: 2.6rem; line-height: 1; margin: 1.1rem 0 .4rem; font-weight: 850; font-variation-settings: "wdth" 125; letter-spacing: -.01em; color: var(--paper); }
.gate-sub { margin: 0 0 1.6rem; color: #B8CBC8; max-width: 32ch; }
.gate form { display: grid; gap: .9rem; }
.gate label { display: grid; gap: .3rem; font-size: .9rem; color: #CFDDDA; }
.gate input {
  font: inherit; padding: .7rem .8rem; border-radius: var(--radius-s); border: 1px solid #2D5560;
  background: #102F38; color: var(--paper);
}
.gate input:focus { outline: 2px solid var(--sand); outline-offset: 1px; }
.form-error { min-height: 1.2em; margin: 0; color: #F2B4A6; font-size: .9rem; }

/* ---------- Desk frame ---------- */
.desk { height: 100%; display: grid; grid-template-rows: auto 1fr; }
.bar {
  display: flex; align-items: center; gap: .9rem; padding: .6rem 1.25rem;
  background: var(--atlantic); color: var(--foam);
}
.bar-logo { height: 30px; width: auto; }
.bar-name { font-weight: 800; font-variation-settings: "wdth" 120; font-size: 1.05rem; letter-spacing: .01em; }
.bar-nav { margin-left: auto; display: flex; align-items: center; gap: 1.1rem; font-size: .92rem; }
.bar-user { color: var(--sand); }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 46%); min-height: 0; }
.split > * { min-width: 0; }
.desk, .bar { max-width: 100vw; }

/* ---------- Conversation ---------- */
.talk { display: grid; grid-template-rows: 1fr auto; min-height: 0; border-right: 1px solid var(--line); background: var(--paper); }
.thread { overflow-y: auto; padding: 2rem clamp(1rem, 4vw, 3rem) 1rem; display: flex; flex-direction: column; gap: 1.1rem; }
.hello h2 { font-size: 1.9rem; font-weight: 850; font-variation-settings: "wdth" 118; margin: 0 0 .4rem; line-height: 1.1; }
.hello p { color: var(--ink-2); margin: 0 0 .8rem; }
.prompts { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; max-width: 62ch; }
.prompt {
  text-align: left; width: 100%; background: var(--foam); border: 1px solid transparent; border-radius: var(--radius-s);
  padding: .65rem .85rem; color: var(--ink);
}
.prompt:hover { border-color: var(--sand); }

.msg { max-width: 68ch; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--atlantic); color: var(--foam); padding: .7rem 1rem; border-radius: var(--radius-l) var(--radius-l) 4px var(--radius-l); }
.msg.bot { align-self: flex-start; }
.msg.bot::before { content: ""; display: block; width: 26px; height: 3px; background: var(--sand); margin-bottom: .45rem; }
.msg.err { color: var(--alert); }
.msg .thumbs { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .5rem; }
.msg .thumbs img { height: 42px; border-radius: 3px; background: #fff; }
.typing { color: var(--ink-2); font-style: italic; }

.change {
  align-self: stretch; max-width: 68ch; border: 1px solid var(--line); border-left: 4px solid var(--sand);
  border-radius: var(--radius-s); padding: .8rem 1rem; background: #FBFCFB; display: grid; gap: .6rem;
}
.change-title { font-weight: 700; }
.change-meta { color: var(--ink-2); font-size: .9rem; }
.change img { max-width: 100%; max-height: 120px; object-fit: contain; justify-self: start; border: 1px solid var(--line); }
.change-actions { display: flex; gap: .6rem; align-items: center; }
.change.done { border-left-color: var(--indian); }
.change.done .change-actions, .change.dropped .change-actions { display: none; }
.change .result { font-size: .92rem; font-weight: 600; color: var(--indian); }
.change.dropped { opacity: .55; }
.change.failed .result { color: var(--alert); }

.composer { position: relative; padding: .8rem clamp(1rem, 4vw, 3rem) 1.1rem; border-top: 1px solid var(--line); background: var(--paper); }
.composer-row { display: flex; align-items: flex-end; gap: .6rem; }
.composer textarea {
  flex: 1; resize: none; font: inherit; border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: .7rem .8rem; max-height: 180px; background: var(--paper); color: var(--ink);
}
.composer textarea:focus { outline: 2px solid var(--indian); outline-offset: 0; }
.attach { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: var(--radius-s); color: var(--ink-2); cursor: pointer; }
.attach:hover { color: var(--ink); border-color: var(--sand); }
.attach input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.send { height: 44px; }
.drop-hint {
  position: absolute; inset: -60px 0 0; display: none; place-items: center; background: rgba(13,43,51,.9);
  color: var(--sand); font-weight: 800; font-variation-settings: "wdth" 120; font-size: 1.2rem; border: 2px dashed var(--sand);
}
.dragging .drop-hint { display: grid; }

.chips { list-style: none; margin: 0 0 .6rem; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.chips:empty { display: none; }
.chip { display: flex; align-items: center; gap: .45rem; background: var(--foam); border-radius: 999px; padding: .25rem .35rem .25rem .3rem; font-size: .85rem; }
.chip img { height: 24px; width: 34px; object-fit: cover; border-radius: 999px; }
.chip .dim { font-variant-numeric: tabular-nums; font-weight: 700; }
.chip.ok .dim { color: var(--indian); }
.chip.bad .dim { color: var(--alert); }
.chip button { border: 0; background: none; color: var(--ink-2); padding: 0 .25rem; font-size: 1rem; line-height: 1; }

/* ---------- Board: real 2OV slot proportions ---------- */
.board { overflow-y: auto; padding: 1.4rem clamp(1rem, 3vw, 2rem) 2rem; background: var(--foam); }
.board-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.client-pick select {
  font: inherit; font-weight: 800; font-variation-settings: "wdth" 118; font-size: 1.35rem; color: var(--ink);
  border: 0; border-bottom: 2px solid var(--sand); background: transparent; padding: .1rem 1.6rem .2rem 0; max-width: 100%;
}
.period { margin: 0; color: var(--ink-2); font-size: .88rem; font-variant-numeric: tabular-nums; }
/* Every slot is drawn at its true width relative to a 1300px page, so sizes read at a glance */
.slots { display: flex; flex-wrap: wrap; gap: 1.2rem 4%; align-items: flex-start; }
.slot { margin: 0; flex: 0 0 auto; }
.slot[data-size="1300x250"], .slot[data-size="1300x90"] { width: 100%; }
.slot[data-size="970x250"], .slot[data-size="970x90"] { width: 74.6%; margin-right: 25.4%; }
.slot[data-size="300x600"], .slot[data-size="300x250"] { width: 23.1%; }
.slot[data-size="300x600"] figcaption, .slot[data-size="300x250"] figcaption { display: grid; gap: 0; }
.slot[data-size="300x600"] .slot-stats, .slot[data-size="300x250"] .slot-stats { margin-left: 0; }
.slot-frame {
  position: relative; width: 100%; background: var(--paper); border: 1px dashed #A9BDB8; border-radius: 3px;
  display: grid; place-items: center; overflow: hidden;
}
.slot-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot-frame img:not([src]), .slot-frame img[src=""] { display: none; }
.slot-empty { color: #8AA19B; font-size: .85rem; }
.slot.filled .slot-frame { border-style: solid; border-color: transparent; }
.slot.filled .slot-empty { display: none; }
.slot.paused .slot-frame img { filter: grayscale(1) opacity(.45); }
.slot.incoming .slot-frame { outline: 3px solid var(--indian); outline-offset: 2px; }
.slot figcaption { display: flex; gap: .7rem; align-items: baseline; flex-wrap: wrap; margin-top: .35rem; font-size: .84rem; }
.slot-size { font-weight: 800; font-variation-settings: "wdth" 112; font-variant-numeric: tabular-nums; }
.slot-where { color: var(--ink-2); }
.slot-stats { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink); }
.slot.paused .slot-stats::before { content: "Paused  "; color: var(--alert); font-weight: 700; }
.board-note { color: var(--ink-2); font-size: .9rem; margin: 1rem 0 0; }

/* ---------- Drawer ---------- */
.drawer { border: 0; padding: 0; margin: 0 0 0 auto; height: 100%; max-height: 100%; width: min(560px, 100vw); background: var(--paper); color: var(--ink); }
.drawer::backdrop { background: rgba(13,43,51,.45); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.4rem; background: var(--atlantic); color: var(--foam); }
.drawer-head h2 { margin: 0; font-size: 1.2rem; font-weight: 800; font-variation-settings: "wdth" 118; }
.drawer-body { padding: 1.2rem 1.4rem 2rem; display: grid; gap: 1.4rem; }
.drawer-body h3 { margin: 0 0 .5rem; font-size: 1rem; font-weight: 800; }
.drawer-body form { display: grid; gap: .7rem; }
.drawer-body label { display: grid; gap: .25rem; font-size: .9rem; color: var(--ink-2); }
.drawer-body input, .drawer-body select { font: inherit; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: var(--radius-s); color: var(--ink); }
.hint { font-size: .85rem; color: var(--ink-2); margin: 0; }
.ok-msg { color: var(--indian); font-weight: 600; margin: 0; }
.log { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.log li { border-bottom: 1px solid var(--line); padding-bottom: .7rem; }
.log .when { color: var(--ink-2); font-size: .82rem; font-variant-numeric: tabular-nums; }
.people { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.people li { display: flex; justify-content: space-between; gap: 1rem; }
.invite-link { word-break: break-all; background: var(--foam); padding: .6rem .7rem; border-radius: var(--radius-s); font-size: .88rem; }

/* ---------- Small screens: stack, board below ---------- */
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; grid-template-rows: minmax(60vh, 1fr) auto; }
  .talk { border-right: 0; border-bottom: 1px solid var(--line); }
  .bar { padding: .6rem 1rem; }
  .bar-name { display: none; }
  .bar-user { display: none; }
  .bar-nav { gap: .8rem; font-size: .85rem; }
  .bar-logo { height: 24px; }
  body { overflow-x: hidden; }
  .msg, .change { max-width: 100%; }
  .send { padding-left: .9rem; padding-right: .9rem; }
  .composer textarea { min-width: 0; }
  .thread { overflow-x: hidden; }
  .talk, .composer, .thread { width: 100vw; }
  .thread, .composer, .board { padding-left: 16px; padding-right: 16px; }
}
