/* ===========================================================================
   AquaPanel — design system (spec §14). Dark theme, orange/yellow accent.
   =========================================================================== */

:root {
  /* Surfaces — neutral, slightly warm dark */
  --bg:            #0F1011;
  --surface:       #17181B;
  --surface-2:     #1F2125;
  --border:        #2A2D33;
  --border-strong: #3A3E45;

  /* Text */
  --text:          #F2F3F5;
  --text-muted:    #A1A6AD;
  --text-disabled: #6B7077;

  /* Accent — orange / yellow */
  --accent:        #FF8A1F;
  --accent-hover:  #FF9A3D;
  --accent-active: #F2740A;
  --accent-soft:   #FBBF24;
  --accent-tint:   rgba(255, 138, 31, 0.12);
  --on-accent:     #1A1206;

  /* Status */
  --success:       #34D399;
  --danger:        #F87171;
  --danger-bg:     rgba(248, 113, 113, 0.12);

  /* Shape & motion */
  --radius:        10px;
  --radius-lg:     14px;
  --shadow:        0 8px 24px rgba(0, 0, 0, 0.35);
  --ring:          0 0 0 3px rgba(255, 138, 31, 0.40);
  --transition:    150ms ease;

  --gradient:      linear-gradient(135deg, var(--accent-soft), var(--accent));
  --font-ui:       Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:     ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 700; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

code, .mono { font-family: var(--font-mono); }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}
.container--narrow { max-width: 720px; }

/* ── App bar ──────────────────────────────────────────────────────────────── */
.appbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(23, 24, 27, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.appbar__inner {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
}
.appbar__nav { display: flex; align-items: center; gap: 12px; }
.appbar__user { color: var(--text-muted); font-size: 14px; }

/* Section tabs */
.tabs { display: flex; gap: 4px; }
.tab {
  display: inline-flex; align-items: center;
  padding: 7px 14px; border-radius: 999px;
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  border: 1px solid transparent;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.is-active { color: var(--accent); background: var(--accent-tint); }
.tab:focus-visible { outline: none; box-shadow: var(--ring); }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; }
.brand:hover { color: var(--text); }
.brand__name { font-size: 18px; letter-spacing: -0.01em; }

/* ── Page head ────────────────────────────────────────────────────────────── */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.page-head__title { font-size: 30px; letter-spacing: -0.02em; }
.page-head__subtitle { color: var(--text-muted); margin-top: 4px; font-size: 14px; }

.section-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.section-title--sub { margin-top: 28px; color: var(--text-muted); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  padding: 10px 16px; min-height: 40px;
  border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn--primary:active { background: var(--accent-active); transform: translateY(0); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn--ghost:hover { border-color: var(--accent); color: var(--text); }
.btn--block { width: 100%; }
.btn--sm { min-height: 32px; padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn[aria-busy="true"] { pointer-events: none; }

.btn__spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.inline-form { display: inline; margin: 0; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  background: var(--accent-tint); color: var(--accent);
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
}

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form { display: block; }
.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 18px; }
.field-grid .field--full, .field-grid .field:has(textarea) { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 14px; font-weight: 500; color: var(--text); }
.field__req { color: var(--accent); margin-left: 2px; }
.field__help { font-size: 13px; color: var(--text-muted); margin: 2px 0 0; }
.field__error { font-size: 13px; color: var(--danger); margin: 2px 0 0; }
.form__error {
  background: var(--danger-bg); border: 1px solid var(--danger);
  color: var(--danger); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 16px; font-size: 14px;
}

.input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit; font-size: 15px;
  padding: 10px 12px; border-radius: var(--radius);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input::placeholder { color: var(--text-disabled); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
textarea.input { resize: vertical; min-height: 88px; }
.field--error .input { border-color: var(--danger); }

.form__actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

/* ── Method select (custom dropdown: name + description per option) ─────────── */
.method-select { position: relative; }
.method-select__trigger {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.method-select__trigger:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.method-select__trigger[aria-expanded="true"] { border-color: var(--accent); }
.method-select__chevron { color: var(--text-muted); transition: transform var(--transition); flex: 0 0 auto; }
.method-select__trigger[aria-expanded="true"] .method-select__chevron { transform: rotate(180deg); }

.method-select__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.method-select__name { font-size: 15px; font-weight: 500; }
.method-select__desc { font-size: 13px; color: var(--text-muted); }

.method-select__menu {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px);
  margin: 0; padding: 6px; list-style: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 320px; overflow-y: auto;
}
.method-select__option {
  display: flex; flex-direction: column; gap: 2px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  transition: background var(--transition);
}
.method-select__option:hover { background: var(--surface-2); }
.method-select__option:focus-visible { outline: none; background: var(--accent-tint); box-shadow: var(--ring); }
.method-select__option.is-selected { background: var(--accent-tint); }
.method-select__option.is-selected .method-select__name { color: var(--accent); }

/* ── Method picker ────────────────────────────────────────────────────────── */
.method-picker { display: flex; gap: 12px; flex-wrap: wrap; }
.method-option {
  flex: 1 1 200px;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px; color: var(--text);
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}
.method-option:hover { border-color: var(--border-strong); color: var(--text); transform: translateY(-1px); }
.method-option.is-selected { border-color: var(--accent); background: var(--accent-tint); }
.method-option__name { font-weight: 600; }
.method-option__desc { font-size: 13px; color: var(--text-muted); }

/* ── Dropzone ─────────────────────────────────────────────────────────────── */
.dropzone {
  position: relative;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 22px; text-align: center;
  transition: border-color var(--transition), background var(--transition);
}
.dropzone.is-dragover { border-color: var(--accent); background: var(--accent-tint); }
.dropzone__input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
}
.dropzone__prompt { display: flex; flex-direction: column; gap: 4px; }
.dropzone__title { font-size: 14px; }
.dropzone__browse { color: var(--accent); text-decoration: underline; }
.dropzone__hint { font-size: 12px; color: var(--text-muted); }
.dropzone__file {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 14px;
}
.dropzone__filename { font-family: var(--font-mono); color: var(--text); word-break: break-all; }
.dropzone__clear {
  background: transparent; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 6px;
}
.dropzone__clear:hover { color: var(--danger); background: var(--danger-bg); }

/* ── Link rows ────────────────────────────────────────────────────────────── */
.linkrow {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--border);
}
.linkrow:first-of-type { border-top: none; }
.linkrow__label {
  flex: 0 0 56px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted);
}
.linkrow__url {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--font-mono); font-size: 13px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 7px 10px; border-radius: 8px;
  overflow-x: auto; white-space: nowrap;
}
.linkrow--lg { padding: 14px 0; }

.copy-btn {
  flex: 0 0 auto;
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--text); border-radius: 8px;
  padding: 7px 12px; font-size: 13px; font-weight: 500; cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.copy-btn:hover { border-color: var(--accent); }
.copy-btn:focus-visible { outline: none; box-shadow: var(--ring); }
.copy-btn.is-copied { border-color: var(--success); color: var(--success); }

/* ── Meeting card ─────────────────────────────────────────────────────────── */
.meeting-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.meeting-card__title { font-size: 18px; }
.meeting-card__title a { color: var(--text); }
.meeting-card__title a:hover { color: var(--accent); }
.meeting-card__meta { display: grid; grid-template-columns: max-content max-content; justify-content: start; gap: 12px 32px; margin: 0 0 14px; }
.meeting-card__meta dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.meeting-card__meta dd { margin: 2px 0 0; font-size: 14px; }

/* ── Detail list ──────────────────────────────────────────────────────────── */
.detail-list { display: grid; gap: 14px; margin: 0; }
.detail-list > div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; align-items: start; }
.detail-list dt { color: var(--text-muted); font-size: 14px; }
.detail-list dd { margin: 0; word-break: break-word; }
.mono-block { font-family: var(--font-mono); font-size: 13px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }

.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.file-list__item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius); }
.file-list__name { font-family: var(--font-mono); font-size: 14px; }
.file-list__meta { color: var(--text-muted); font-size: 13px; }

/* ── Empty / success states ───────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state__code { font-size: 48px; font-weight: 700; color: var(--accent); }
.empty-state__title { font-size: 22px; margin-bottom: 8px; }
.empty-state__text { color: var(--text-muted); margin: 0 auto 20px; max-width: 42ch; }

.success-card { text-align: center; }
.success-card__icon {
  width: 56px; height: 56px; margin: 0 auto 14px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--accent-tint); color: var(--accent); font-size: 28px; font-weight: 700;
}
.success-card__title { font-size: 26px; }
.success-card__subtitle { color: var(--text-muted); margin: 8px 0 22px; }
.success-card .linkrow { text-align: left; }
.success-card .form__actions { justify-content: center; }

/* ── Auth screens ─────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.auth__glow {
  position: absolute; top: -10%; left: 50%; transform: translateX(-50%);
  width: 640px; height: 640px; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 138, 31, 0.18), transparent 62%);
  filter: blur(8px);
}
.auth-card { width: 100%; max-width: 400px; position: relative; }
.auth-card__brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 18px; }
.auth-card__title { font-size: 24px; text-align: center; }
.auth-card__subtitle { color: var(--text-muted); text-align: center; margin: 8px 0 22px; font-size: 14px; }
.auth-card .form { display: flex; flex-direction: column; gap: 16px; }
.auth-card__alt { text-align: center; color: var(--text-muted); font-size: 14px; margin: 20px 0 0; }

/* ── Toasts ───────────────────────────────────────────────────────────────── */
.toast-region {
  position: fixed; top: 16px; right: 16px; z-index: 100;
  display: flex; flex-direction: column; gap: 10px; max-width: 360px;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-left-width: 3px; border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow); font-size: 14px;
  animation: toast-in 200ms ease;
}
.toast--success { border-left-color: var(--success); }
.toast--danger  { border-left-color: var(--danger); }
.toast--info    { border-left-color: var(--accent); }
.toast.is-leaving { opacity: 0; transform: translateX(12px); transition: opacity 200ms ease, transform 200ms ease; }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .appbar__inner { flex-wrap: wrap; gap: 10px; justify-content: center; }
  .tabs { order: 3; width: 100%; justify-content: center; }
  .field-grid { grid-template-columns: 1fr; }
  .detail-list > div { grid-template-columns: 1fr; gap: 2px; }
  .page-head__title { font-size: 24px; }
  .linkrow { flex-wrap: wrap; }
  .linkrow__label { flex-basis: 100%; }
}

/* ── Reduced motion ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
