/* The shared base for every page the control plane serves: the tokens, then
   the few primitives the sign-in pages and the operator console both draw.
   Values are the customer console's (dashboard/src/index.css), so the three
   read as one product; a change to one belongs in both.

   Inter is served from this origin rather than Google Fonts, which the
   customer console uses: CONTROL_UI_CSP refuses any third-party stylesheet or
   font. Latin subset, variable 400-700, the same file Google serves. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --surface-ground: #f5f6fa;
  --surface-card: #ffffff;
  --surface-well: #eceef4;
  --surface-input: #f3f4f8;
  --surface-hover: #fafaff;

  --color-line: #e7e9f0;
  --color-line-bright: #d6dae4;
  --color-line-hover: #c3c8d4;
  --color-chalk: #111827;
  --color-mute: #4b5563;
  --color-faint: #6b7280;
  --color-placeholder: #9097a3;

  --color-ours: #4f46e5;
  --color-ours-tint: #eef0ff;
  --color-ours-line: #c7d2fe;
  --color-alarm: #e11d48;
  --color-alarm-ink: #be123c;
  --color-alarm-tint: #fff1f2;
  --color-alarm-line: #fecdd3;
  --color-waiting-ink: #92400e;
  --color-waiting-tint: #fffbeb;
  --color-waiting-line: #fde68a;
  --color-theirs-ink: #a15c07;
  --color-good: #10b981;
  --color-good-ink: #047857;
  --color-good-tint: #ecfdf5;
  --color-good-line: #a7f3d0;

  --shadow-xs: 0 1px 2px rgb(16 24 40 / 0.05);
  --shadow-sm: 0 1px 3px rgb(16 24 40 / 0.06), 0 1px 2px rgb(16 24 40 / 0.04);
  --shadow-md: 0 6px 16px -4px rgb(16 24 40 / 0.1), 0 2px 4px -2px rgb(16 24 40 / 0.05);
  --shadow-lg: 0 16px 40px -12px rgb(16 24 40 / 0.18);
  --shadow-brand: 0 6px 16px -6px rgb(79 70 229 / 0.55);
  --focus-ring: 0 0 0 4px rgb(99 102 241 / 0.16);

  --brand: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
  --brand-hover: linear-gradient(135deg, #5558f0 0%, #6d28d9 100%);
  --ground-wash: radial-gradient(900px 460px at 50% -160px, rgb(99 102 241 / 0.12), transparent 70%);

  --r-2: 8px;
  --r-3: 10px;
  --r-4: 14px;
  --r-5: 18px;

  --t-in: 140ms;
  --t-lift: 220ms;
  --ease-mat: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);

  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* `hidden` is only a user-agent `display: none`, which any author `display`
   rule outranks, and admin.js shows and hides whole layout blocks with it. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-chalk);
  background: var(--surface-ground);
  font-feature-settings: "cv11" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--color-ours);
}

:focus-visible {
  outline: 2px solid var(--color-ours);
  outline-offset: 2px;
}

/* ── brand ──
   The logo is these two rules and nothing else. Every page draws an empty
   <span class="brand-mark"> (the T) or <span class="brand-lockup"> (the T over
   the wordmark), so a new logo is an edit here. Masks rather than <img>: the
   shape takes the text colour, and an image that fails to load leaves nothing
   behind instead of a broken-image icon. */

.brand-mark,
.brand-lockup {
  display: inline-block;
  flex: none;
  width: auto;
  background-color: currentColor;
  forced-color-adjust: none;
}

.brand-mark {
  height: 22px;
  aspect-ratio: 340 / 256;
  -webkit-mask: url("/brand/mark-black.png") center / contain no-repeat;
  mask: url("/brand/mark-black.png") center / contain no-repeat;
}

.brand-lockup {
  height: 64px;
  aspect-ratio: 847 / 480;
  -webkit-mask: url("/brand/lockup-black.png") center / contain no-repeat;
  mask: url("/brand/lockup-black.png") center / contain no-repeat;
}

.brand-name {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1;
}

/* ── fields ── */

label {
  display: block;
  margin-bottom: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-mute);
}

input:not([type="checkbox"], [type="radio"]),
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  font-size: 14px;
  color: var(--color-chalk);
  background-color: var(--surface-card);
  border: 1px solid var(--color-line-bright);
  border-radius: var(--r-3);
  box-shadow: var(--shadow-xs);
  transition:
    border-color var(--t-in) var(--ease-mat),
    box-shadow var(--t-in) var(--ease-mat),
    background-color var(--t-in) var(--ease-mat);
}

select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  cursor: pointer;
}

input:not([type="checkbox"], [type="radio"]):hover,
select:hover,
textarea:hover {
  border-color: var(--color-line-hover);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-placeholder);
}

input:not([type="checkbox"], [type="radio"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-ours);
  box-shadow: var(--focus-ring);
}

input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  color: var(--color-faint);
  background-color: var(--surface-input);
}

input[type="checkbox"] {
  accent-color: var(--color-ours);
}

/* ── buttons ── */

.con-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  color: var(--color-chalk);
  background: var(--surface-card);
  border: 1px solid var(--color-line-bright);
  border-radius: var(--r-3);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  user-select: none;
  transition:
    background-color var(--t-in) var(--ease-mat),
    border-color var(--t-in) var(--ease-mat),
    box-shadow var(--t-in) var(--ease-mat),
    color var(--t-in) var(--ease-mat),
    transform var(--t-in) var(--ease-mat);
}

.con-btn svg {
  flex: none;
  width: 16px;
  height: 16px;
}

.con-btn:hover {
  background: #f9fafc;
  border-color: var(--color-line-hover);
}

.con-btn:active {
  transform: scale(0.97);
}

.con-btn-ours {
  color: #fff;
  background: var(--brand);
  border-color: transparent;
  box-shadow: var(--shadow-brand), inset 0 1px 0 rgb(255 255 255 / 0.18);
}

.con-btn-ours:hover {
  background: var(--brand-hover);
  border-color: transparent;
  box-shadow: 0 10px 22px -8px rgb(79 70 229 / 0.6), inset 0 1px 0 rgb(255 255 255 / 0.18);
}

.con-btn-alarm {
  color: var(--color-alarm-ink);
  border-color: var(--color-alarm-line);
}

.con-btn-alarm:hover {
  background: var(--color-alarm-tint);
  border-color: #fda4af;
}

.con-btn-ghost {
  color: var(--color-mute);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.con-btn-ghost:hover {
  color: var(--color-chalk);
  background: var(--surface-well);
  border-color: transparent;
}

.con-btn:disabled,
.con-btn:disabled:hover {
  cursor: not-allowed;
  transform: none;
  color: var(--color-placeholder);
  background: var(--surface-input);
  border-color: var(--color-line);
  box-shadow: none;
}

/* ── surfaces and notices ── */

.plate {
  background: var(--surface-card);
  border: 1px solid var(--color-line);
  border-radius: var(--r-4);
  box-shadow: var(--shadow-sm);
}

/* An empty box takes no space, so a card does not jump on its first failure. */
.notice,
.error {
  margin: 0;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  border-radius: var(--r-3);
  overflow-wrap: anywhere;
  animation: fade-up var(--t-lift) var(--ease-mat) both;
}

.notice:empty,
.error:empty {
  display: none;
}

.notice-alarm,
.error {
  color: var(--color-alarm-ink);
  background: var(--color-alarm-tint);
  box-shadow: inset 0 0 0 1px var(--color-alarm-line);
}

.notice-waiting {
  color: var(--color-waiting-ink);
  background: var(--color-waiting-tint);
  box-shadow: inset 0 0 0 1px var(--color-waiting-line);
}

.notice-good {
  color: var(--color-good-ink);
  background: var(--color-good-tint);
  box-shadow: inset 0 0 0 1px var(--color-good-line);
}

/* Touch, at any width. Under 16px iOS zooms the page when a field takes focus
   and leaves it zoomed; under 44px a thumb lands on the button next door. */
@media (max-width: 767px), (pointer: coarse) {
  input:not([type="checkbox"], [type="radio"]),
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .con-btn {
    min-height: 44px;
    padding: 0 16px;
    font-size: 14px;
  }
}

/* ── motion ── */

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: none;
  }
}

@keyframes tab-in {
  from {
    opacity: 0;
    transform: scaleX(0.2);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* Windows High Contrast drops shadows and gradient fills, so edges are restated. */
@media (forced-colors: active) {
  .plate,
  .con-btn,
  .notice,
  .error {
    border: 1px solid CanvasText;
    box-shadow: none;
  }
}
