/* ===== Cold Gray Minimal Design System ===== */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-hi: #f4f4f5;
  --text: #18181b;
  --text-muted: #71717a;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.08);
  --warning: #ca8a04;
  --warning-soft: rgba(202, 138, 4, 0.08);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --purple: #7c3aed;
  --purple-soft: rgba(124, 58, 237, 0.08);
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Screen reader only ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ===== Topbar ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar-inner {
  width: min(800px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-divider {
  width: 1px;
  height: 14px;
  background: var(--line-strong);
}

.brand-text {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-status {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ===== Shell (Main Container) ===== */
.shell {
  position: relative;
  z-index: 1;
  width: min(800px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 24px;
  display: grid;
  gap: 20px;
}

/* ===== Card Base ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}

/* ===== Hero Form ===== */
.hero-form {
  display: grid;
  gap: 16px;
}

.hero-title {
  margin: 0;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.hero-input-group {
  display: grid;
  gap: 10px;
}

.hero-field {
  display: block;
}

.hero-field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  padding: 12px 16px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.hero-field input::placeholder {
  color: #a1a1aa;
}

.hero-field input:hover {
  border-color: var(--line-strong);
}

.hero-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-hero {
  min-height: 48px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-lg);
}

/* ===== Result Panel (inline) ===== */
.result-panel {
  display: none;
  gap: 12px;
}

.result-panel:has(.link-output:not(.empty)),
.result-panel:has(.status-output.success),
.result-panel:has(.status-output.error),
.result-panel:has(.status-output.pending) {
  display: grid;
}

.result-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 14px;
}

.result-success {
  border-color: rgba(22, 163, 74, 0.2);
  background: linear-gradient(180deg, rgba(22, 163, 74, 0.03), var(--surface));
}

.result-label {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.link-output {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-hi);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  line-height: 1.4;
  word-break: break-all;
  font-family: var(--font-mono);
  font-size: 13px;
}

.link-output.empty {
  color: var(--text-muted);
  font-family: var(--font-sans);
}

.link-output a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.link-output a:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

.result-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.result-actions.compact .btn {
  min-width: 0;
}

.disabled-link {
  pointer-events: none;
  opacity: 0.35;
}

/* ===== Status Output ===== */
.status-output {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

.status-output.success {
  color: var(--success);
}

.status-output.error {
  color: var(--danger);
}

.status-output.pending {
  color: var(--warning);
}

.meta-output {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.code-box {
  margin: 0;
  max-height: 200px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-hi);
  padding: 12px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
}

/* ===== More Options (Details/Summary) ===== */
.more-options {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.more-options > summary {
  position: relative;
  list-style: none;
  cursor: pointer;
  display: grid;
  gap: 2px;
  padding: 12px 14px 12px 32px;
  transition: background 0.15s ease;
}

.more-options > summary:hover {
  background: var(--surface-hi);
}

.more-options > summary::-webkit-details-marker {
  display: none;
}

.more-options > summary::before {
  content: "▸";
  position: absolute;
  left: 14px;
  top: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.more-options > summary span:first-child {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.summary-note {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.more-options[open] > summary {
  border-bottom: 1px solid var(--line);
}

.more-options[open] > summary::before {
  content: "▾";
}

.more-options-body {
  padding: 14px;
}

/* ===== Form Stack ===== */
.form-stack {
  display: grid;
  gap: 16px;
}

.form-section {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-hi);
  padding: 14px;
}

.section-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* ===== Form Grid & Fields ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.field em {
  color: var(--danger);
  font-style: normal;
  margin-left: 2px;
}

.field small {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.field-span-2 {
  grid-column: 1 / -1;
}

.combo-field .combo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.combo-field .combo > .csel {
  min-width: 0;
}


/* ===== Inputs ===== */
input,
select,
button,
textarea {
  font: inherit;
}

input:not([type="checkbox"]),
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:not([type="checkbox"])::placeholder,
textarea::placeholder {
  color: #a1a1aa;
}

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

input:not([type="checkbox"]):focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%2371717a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

select option {
  background: var(--surface);
  color: var(--text);
}

.readonly-box {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-hi);
  display: flex;
  align-items: center;
  padding: 8px 12px;
  color: var(--text-muted);
  word-break: break-all;
}

/* ===== Toggles ===== */
.toggles {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px;
  display: grid;
  gap: 4px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.toggle:hover {
  background: var(--surface-hi);
}

.toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.toggle span {
  font-size: 13px;
  color: var(--text);
}

/* ===== Error Block ===== */
.inline-error {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(220, 38, 38, 0.2);
  background: rgba(220, 38, 38, 0.05);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}

/* ===== Buttons ===== */
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  min-height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: var(--surface-hi);
  border-color: var(--line-strong);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hi);
  border-color: var(--line-strong);
}

.btn-mini {
  min-height: 38px;
  padding-inline: 10px;
}

/* ===== Badge ===== */
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-hi);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--line);
}

.badge.ok {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(22, 163, 74, 0.2);
}

.badge.warn {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: rgba(202, 138, 4, 0.2);
}

.badge.err {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.2);
}

/* ===== History Details ===== */
.history-details {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.history-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  transition: background 0.15s ease;
}

.history-summary::-webkit-details-marker {
  display: none;
}

.history-summary::before {
  content: "▸";
  color: var(--text-muted);
  font-size: 12px;
}

.history-details[open] > .history-summary {
  border-bottom: 1px solid var(--line);
}

.history-details[open] > .history-summary::before {
  content: "▾";
}

.history-summary:hover {
  background: var(--surface-hi);
}

.title-count {
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== List Panel ===== */
.list-panel {
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 16px;
}

.panel-head {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.panel-kicker {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.list-panel-head {
  align-items: center;
}

.list-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.list-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, auto) minmax(110px, auto);
  gap: 8px;
  margin-bottom: 12px;
}

.toolbar-search {
  display: block;
}

/* ===== Table ===== */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.history-table thead th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-hi);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.history-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 12px;
  color: var(--text);
}

.history-table tbody tr:last-child td {
  border-bottom: none;
}

.history-row {
  transition: background 0.15s ease;
}

.history-row:hover {
  background: var(--surface-hi);
}

.col-short { width: 22%; }
.col-target { width: 34%; }
.col-group { width: 14%; }
.col-clicks { width: 12%; }
.col-status { width: 10%; }
.col-actions { width: 28%; }

.table-link {
  display: inline-block;
  max-width: 100%;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-link:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

.table-subtext {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-hi);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
}

.table-pill.success {
  background: var(--success-soft);
  color: var(--success);
}

.table-pill.info {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ===== Table Actions ===== */
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.action-btn {
  min-height: 28px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-muted);
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.action-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.action-btn.danger:hover {
  border-color: rgba(220, 38, 38, 0.3);
  color: var(--danger);
  background: var(--danger-soft);
}

.table-empty {
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== Footer ===== */
.app-footer {
  padding: 8px 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.app-footer p {
  margin: 0;
}

.app-footer-links {
  display: flex;
  gap: 16px;
}

.app-footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.app-footer-links a:hover {
  color: var(--accent);
}

/* ===== Modal ===== */
.modal {
  border: none;
  padding: 0;
  background: transparent;
  width: min(520px, calc(100% - 24px));
  max-width: 520px;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
}

.modal-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  padding: 16px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: 700;
}

.modal-body {
  padding-top: 14px;
  display: grid;
  gap: 12px;
}

.modal-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-hi);
  color: var(--text);
}

/* ===== QR Modal ===== */
.qr-modal-card {
  width: min(520px, calc(100vw - 24px));
}

.qr-modal-body {
  gap: 14px;
}

.qr-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-hi);
  min-height: 240px;
  display: grid;
  place-items: center;
  padding: 16px;
}

.qr-preview img {
  width: min(280px, 100%);
  height: auto;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.qr-placeholder {
  color: var(--text-muted);
  font-size: 13px;
}

.qr-meta .link-output {
  margin-top: 0;
}

/* ===== Utility ===== */
[data-key-field][hidden] {
  display: none !important;
}

/* ===== Focus Visible ===== */
.topbar a:focus-visible,
.btn:focus-visible,
.action-btn:focus-visible,
.icon-btn:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ===== Scrollbar (Webkit) ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1aa;
}

/* ===== Responsive: Tablet ===== */
@media (max-width: 860px) {
  .topbar-inner,
  .shell {
    width: calc(100% - 32px);
  }

  .list-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .list-toolbar .toolbar-search {
    grid-column: 1 / -1;
  }
}

/* ===== Responsive: Mobile ===== */
@media (max-width: 540px) {
  .topbar-inner,
  .shell {
    width: calc(100% - 24px);
  }

  .shell {
    padding-top: 24px;
  }

  .hero-title {
    font-size: 20px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: auto;
  }

  .combo-field .combo {
    grid-template-columns: 1fr;
  }

  .result-actions,
  .modal-actions,
  .list-head-actions {
    flex-direction: column;
  }

  .btn,
  .result-actions .btn,
  .modal-actions .btn,
  .list-head-actions .btn {
    width: 100%;
  }

  .list-toolbar {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    overflow: auto;
  }

  .history-table {
    min-width: 860px;
  }

  .app-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== Custom Select (csel) ===== */
.csel-native {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

.csel {
  position: relative;
}

.csel-trigger {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.csel-trigger:hover:not(:disabled) {
  border-color: var(--line-strong);
}

.csel.open .csel-trigger,
.csel-trigger:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.csel-trigger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.csel-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.csel-label.placeholder {
  color: var(--text-muted);
}

.csel-arrow {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 12px;
  transition: transform 0.15s ease;
}

.csel.open .csel-arrow {
  transform: rotate(180deg);
}

.csel-list {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
}

.csel.open .csel-list {
  display: block;
}

.csel-option {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.csel-option:hover {
  background: var(--surface-hi);
}

.csel-option.selected {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
}

.csel-option.placeholder {
  color: var(--text-muted);
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
