/* ==========================================================================
   Duck Rental · shared foundation
   ========================================================================== */
:root {
  --bg: #f5f7fa;
  --bg-deep: #eef2f7;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --panel-3: #f1f5f9;
  --line: rgba(15, 23, 42, 0.14);
  --line-strong: rgba(15, 23, 42, 0.23);
  --text: #0b1220;
  --muted: #334155;
  --faint: #475569;
  --accent: #0f766e;
  --accent-2: #0d9488;
  --accent-bright: #5eead4;
  --on-accent: #ffffff;
  --accent-soft: rgba(15, 118, 110, 0.08);
  --accent-line: rgba(15, 118, 110, 0.26);
  --violet: #7c3aed;
  --violet-soft: rgba(124, 58, 237, 0.08);
  --amber: #b45309;
  --amber-soft: rgba(180, 83, 9, 0.1);
  --rose: #be123c;
  --rose-soft: rgba(190, 18, 60, 0.08);
  --blue: #2563eb;
  --blue-soft: rgba(37, 99, 235, 0.08);
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-mint: #f0fdfa;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-lg: 0 32px 80px -40px rgba(15, 23, 42, 0.26);
  --shadow-md: 0 18px 44px -28px rgba(15, 23, 42, 0.2);
  --font: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC",
    "Hiragino Sans GB", sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Consolas,
    "Liberation Mono", monospace;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 92px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(760px 480px at 10% -8%, rgba(94, 234, 212, 0.3), transparent 62%),
    radial-gradient(720px 520px at 92% 4%, rgba(167, 139, 250, 0.16), transparent 66%),
    radial-gradient(1000px 640px at 50% 108%, rgba(45, 212, 191, 0.13), transparent 70%),
    linear-gradient(180deg, #f9fbfd 0%, #eef3f8 100%);
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.55;
  background-image: linear-gradient(rgba(15, 23, 42, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.045) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 0%, black, transparent 75%);
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

img,
svg {
  display: block;
  max-width: 100%;
}

::selection {
  background: rgba(13, 148, 136, 0.22);
  color: #0f172a;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.02em;
}

/* Brand lockup */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  filter: drop-shadow(0 6px 14px rgba(15, 23, 42, 0.12));
}

.brand-text {
  display: grid;
  line-height: 1.15;
  min-width: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 750;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.18) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.16);
  border-radius: 999px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease,
    color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  user-select: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, #14b8a6 0%, #0d9488 55%, #0f766e 100%);
  color: var(--on-accent);
  box-shadow: 0 14px 30px -14px rgba(13, 148, 136, 0.55);
}

.btn-primary:hover {
  box-shadow: 0 18px 36px -14px rgba(13, 148, 136, 0.65);
}

.btn-ghost {
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--text);
}

.btn-ghost:hover {
  border-color: rgba(15, 118, 110, 0.42);
  background: rgba(15, 118, 110, 0.06);
}

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

.btn-soft:hover {
  background: rgba(15, 118, 110, 0.16);
}

.btn-violet {
  background: var(--violet-soft);
  border-color: rgba(109, 40, 217, 0.32);
  color: #6d28d9;
}

.btn-danger {
  background: var(--rose-soft);
  border-color: rgba(190, 18, 60, 0.3);
  color: #be123c;
}

.btn-danger:hover {
  background: rgba(190, 18, 60, 0.2);
}

.btn-sm {
  height: 32px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 12px;
}

.btn-lg {
  height: 52px;
  padding: 0 26px;
  border-radius: 14px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.02);
  color: var(--muted);
  font-size: 14px;
}

.btn-icon:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: rgba(15, 23, 42, 0.05);
}

.btn[aria-busy="true"] {
  pointer-events: none;
  opacity: 0.75;
}

.btn[aria-busy="true"] .btn-label {
  opacity: 0.6;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Forms
   ========================================================================== */
.field {
  display: grid;
  gap: 7px;
}

.field > label,
.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.field input,
.field select,
.field textarea,
.input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #ffffff;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.field textarea {
  height: auto;
  min-height: 88px;
  padding: 11px 13px;
  resize: vertical;
  line-height: 1.55;
}

.field input::placeholder,
.field textarea::placeholder,
.input::placeholder {
  color: #94a3b8;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus {
  outline: none;
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #94a3b8 50%),
    linear-gradient(135deg, #94a3b8 50%, transparent 50%);
  background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.hint {
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.55;
}

.error-text {
  color: #be123c;
  font-size: 12px;
  min-height: 18px;
}

.success-text {
  color: var(--accent);
  font-size: 12px;
}

.input-group {
  display: flex;
}

.input-group .input {
  border-radius: 11px 0 0 11px;
}

.input-group .btn {
  border-radius: 0 11px 11px 0;
  height: 44px;
}

/* ==========================================================================
   Cards, chips, tables
   ========================================================================== */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
  box-shadow: var(--shadow-md);
}

.card-pad {
  padding: 22px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.025);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.chip::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.8;
}

.chip-accent {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}

.chip-amber {
  border-color: rgba(180, 83, 9, 0.28);
  background: var(--amber-soft);
  color: var(--amber);
}

.chip-rose {
  border-color: rgba(190, 18, 60, 0.28);
  background: var(--rose-soft);
  color: #be123c;
}

.chip-violet {
  border-color: rgba(109, 40, 217, 0.3);
  background: var(--violet-soft);
  color: #6d28d9;
}

.chip-blue {
  border-color: rgba(37, 99, 235, 0.3);
  background: var(--blue-soft);
  color: #1d4ed8;
}

.chip-plain::before {
  display: none;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

table.data th {
  padding: 11px 14px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

table.data td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  color: #334155;
  vertical-align: middle;
}

table.data tbody tr {
  transition: background 0.14s ease;
}

table.data tbody tr:hover {
  background: rgba(15, 118, 110, 0.035);
}

table.data tbody tr:last-child td {
  border-bottom: 0;
}

.table-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.mono {
  font-family: var(--mono);
  font-variant-ligatures: none;
}

.muted {
  color: var(--muted);
}

.faint {
  color: var(--faint);
}

.small {
  font-size: 11.5px;
}

.nowrap {
  white-space: nowrap;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 56px 24px;
  text-align: center;
  color: var(--muted);
}

.empty-state .empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.025);
  font-size: 22px;
}

.empty-state h3 {
  color: var(--text);
  font-size: 15px;
}

.empty-state p {
  max-width: 360px;
  font-size: 12px;
  color: var(--faint);
}

/* ==========================================================================
   Dialogs and toasts
   ========================================================================== */
dialog.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.2);
  border-radius: 20px;
  background: linear-gradient(165deg, #ffffff, #f8fafc 78%);
  color: var(--text);
  box-shadow: 0 40px 90px -30px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

dialog.modal.wide {
  width: min(680px, calc(100vw - 32px));
}

dialog.modal::backdrop {
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(8px);
}

dialog.modal[open] {
  animation: modal-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 0;
}

.modal-head h2 {
  font-size: 18px;
}

.modal-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.modal-close {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
  background: rgba(15, 23, 42, 0.05);
}

.modal-body {
  display: grid;
  gap: 15px;
  padding: 20px 24px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 0 24px 22px;
}

.modal-note {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  display: grid;
  gap: 9px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 24px 60px -20px rgba(15, 23, 42, 0.14);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.55;
  pointer-events: auto;
  animation: toast-in 0.22s ease;
}

.toast::before {
  content: "✓";
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.toast.error {
  border-color: rgba(190, 18, 60, 0.3);
}

.toast.error::before {
  content: "!";
  background: var(--rose-soft);
  color: #be123c;
}

.toast.info::before {
  content: "i";
  background: var(--blue-soft);
  color: #1d4ed8;
}

.toast.leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: all 0.2s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.confirm-body {
  padding: 8px 24px 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

/* ==========================================================================
   Misc
   ========================================================================== */
.divider {
  height: 1px;
  background: var(--line);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.clipboard-helper {
  position: fixed;
  left: -9999px;
  top: 0;
  opacity: 0;
  pointer-events: none;
}

.text-accent {
  color: var(--accent);
}

.text-rose {
  color: #be123c;
}

.text-amber {
  color: var(--amber);
}

.text-right {
  text-align: right;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.loading-block {
  display: grid;
  place-items: center;
  min-height: 240px;
  color: var(--muted);
  gap: 12px;
  font-size: 12px;
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.06), rgba(15, 23, 42, 0.12), rgba(15, 23, 42, 0.06));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (max-width: 720px) {
  .field-row,
  .field-row-3 {
    grid-template-columns: 1fr;
  }

  .toast-stack {
    right: 16px;
    bottom: 16px;
  }

  .modal-head {
    padding: 18px 18px 0;
  }

  .modal-body {
    padding: 16px 18px;
  }

  .modal-foot {
    padding: 0 18px 18px;
  }
}
