/* 短链助手 - 清爽后台工作台样式 */

:root {
  --bg-page: #f7f9fc;
  --bg-surface: #ffffff;
  --bg-subtle: #eef4f8;
  --bg-muted: #f3f6fa;
  --text-main: #172033;
  --text-soft: #607089;
  --text-muted: #8996a8;
  --line: #dce5ee;
  --line-strong: #c8d5e2;
  --primary: #3157d5;
  --primary-dark: #2445b4;
  --primary-soft: #e8eeff;
  --teal: #0d9488;
  --teal-soft: #e4f7f4;
  --amber: #b7791f;
  --amber-soft: #fff5da;
  --rose: #be4763;
  --rose-soft: #ffe8ee;
  --danger: #d9303e;
  --danger-soft: #ffe8eb;
  --success: #0f8f61;
  --success-soft: #e4f7ec;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 30px rgba(28, 45, 78, 0.10);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text-main);
  background:
    linear-gradient(180deg, rgba(232, 238, 255, 0.72), transparent 320px),
    var(--bg-page);
}

body.auth-page {
  background:
    radial-gradient(circle at 18% 14%, rgba(49, 87, 213, 0.12), transparent 32%),
    linear-gradient(135deg, #f8fbff 0%, #eef4f8 100%);
}

a {
  color: var(--primary);
  text-decoration: none;
}

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

button {
  border: 0;
  cursor: pointer;
}

svg {
  display: block;
}

/* Brand */
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  box-shadow: 0 10px 22px rgba(49, 87, 213, 0.22);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Auth */
.auth-shell {
  min-height: 100vh;
  width: min(1080px, calc(100% - 36px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: center;
  gap: 48px;
}

.auth-intro {
  min-height: 520px;
  padding: 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, rgba(255,255,255,0.96), rgba(244,248,252,0.9));
  box-shadow: var(--shadow-md);
}

.auth-copy h1 {
  max-width: 560px;
  margin: 0;
  font-size: 46px;
  line-height: 1.08;
  letter-spacing: 0;
}

.auth-copy p:last-child {
  max-width: 500px;
  margin: 18px 0 0;
  color: var(--text-soft);
  font-size: 17px;
  line-height: 1.8;
}

.auth-panel,
.tool-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
}

.auth-panel {
  padding: 34px;
}

.panel-heading {
  margin-bottom: 24px;
}

.panel-heading.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h2,
.workspace-header h1 {
  margin: 0;
  color: var(--text-main);
  letter-spacing: 0;
}

.panel-heading h2 {
  font-size: 24px;
}

.form-stack {
  display: grid;
  gap: 18px;
}

.form-group {
  display: grid;
  gap: 8px;
}

.form-label,
.result-copy label {
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 700;
}

.form-input {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--text-main);
  background: #ffffff;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.form-input::placeholder {
  color: #9aa7b7;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(49, 87, 213, 0.12);
}

.password-field {
  position: relative;
}

.password-field .form-input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  background: transparent;
}

.password-toggle:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.password-toggle svg {
  width: 19px;
  height: 19px;
}

.form-error {
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 14px;
  font-weight: 700;
}

.form-error svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

/* Buttons */
.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-weight: 800;
  line-height: 1;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.btn svg {
  width: 17px;
  height: 17px;
}

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

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

.btn-primary {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 12px 22px rgba(49, 87, 213, 0.22);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

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

.btn-secondary:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.btn-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #ffd0d5;
}

.btn-sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.btn-lg {
  min-height: 50px;
  font-size: 16px;
}

.btn-full {
  width: 100%;
}

.btn:disabled,
.btn-loading {
  opacity: 0.72;
  cursor: wait;
}

.btn-loading {
  color: transparent !important;
}

.btn-loading::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.42);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

/* Dashboard */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 66px;
  padding: 0 clamp(18px, 4vw, 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(220, 229, 238, 0.86);
  background: rgba(247, 249, 252, 0.86);
  backdrop-filter: blur(14px);
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: #ffffff;
  font-size: 14px;
}

.user-chip svg {
  width: 16px;
  height: 16px;
}

.dashboard-shell {
  width: min(1320px, calc(100% - 36px));
  margin: 0 auto;
  padding: 30px 0 56px;
}

.workspace-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.workspace-header h1 {
  font-size: 32px;
  line-height: 1.2;
}

.workspace-header p:last-child {
  margin: 8px 0 0;
  color: var(--text-soft);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  min-height: 112px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
}

.stat-icon svg {
  width: 23px;
  height: 23px;
}

.stat-icon.indigo {
  color: var(--primary);
  background: var(--primary-soft);
}

.stat-icon.teal {
  color: var(--teal);
  background: var(--teal-soft);
}

.stat-icon.amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.stat-icon.rose {
  color: var(--rose);
  background: var(--rose-soft);
}

.stat-value {
  color: var(--text-main);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.stat-label {
  margin-top: 7px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 18px;
  margin-bottom: 18px;
}

.tool-panel {
  padding: 22px;
}

.chart-panel {
  min-height: 372px;
}

.soft-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--primary-soft);
  font-size: 13px;
  font-weight: 800;
}

.form-input-group {
  display: flex;
  min-width: 0;
}

.input-addon {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-right: 0;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  color: var(--text-soft);
  background: var(--bg-muted);
  font: 13px var(--font-mono);
  white-space: nowrap;
}

.form-input-group .form-input {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.result-panel {
  display: none;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  align-items: center;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid #cbd8ff;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #f7f9ff, #f2fbfa);
}

.result-panel.show {
  display: grid;
  animation: slideUp 220ms ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-copy {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.copy-line {
  display: flex;
  gap: 10px;
  min-width: 0;
}

.copy-line input,
.short-url-display input {
  min-width: 0;
  flex: 1;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--primary-dark);
  background: #ffffff;
  font: 14px var(--font-mono);
}

.qr-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.qr-card span {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

#qrCanvas {
  display: block;
  width: 220px;
  height: 220px;
  border-radius: var(--radius-sm);
  background: #ffffff;
}

/* Chart */
.bar-chart {
  min-height: 246px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 0;
}

.bar-item {
  min-width: 0;
  flex: 1;
  height: 236px;
  display: grid;
  grid-template-rows: 1fr auto auto;
  justify-items: center;
  gap: 8px;
}

.bar-track {
  width: 100%;
  max-width: 42px;
  height: 176px;
  display: flex;
  align-items: flex-end;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
}

.bar-fill {
  width: 100%;
  min-height: 5px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(180deg, var(--primary), var(--teal));
  transition: height 420ms ease;
}

.bar-value {
  color: var(--text-main);
  font-size: 13px;
  font-weight: 900;
}

.bar-label {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.chart-empty {
  width: 100%;
  min-height: 220px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--text-soft);
  text-align: center;
}

.chart-empty svg {
  width: 42px;
  height: 42px;
  color: var(--text-muted);
}

/* API panel */
.api-panel {
  margin-bottom: 18px;
}

.api-panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 22px;
  align-items: stretch;
}

.api-summary {
  max-width: 680px;
  margin: -8px 0 18px;
  color: var(--text-soft);
  line-height: 1.8;
}

.api-summary code,
.endpoint-line,
.code-block {
  font-family: var(--font-mono);
}

.api-summary code {
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.api-field {
  display: grid;
  gap: 9px;
}

.api-field label {
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 800;
}

.api-token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
}

.api-token-row input {
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  color: var(--text-main);
  background: #ffffff;
  font: 13px var(--font-mono);
  outline: none;
}

.api-example-card {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #f8fbff;
}

.api-example-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.api-example-head span {
  color: var(--text-main);
  font-weight: 900;
}

.api-example-head div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.endpoint-line {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d8e3ff;
  border-radius: var(--radius-md);
  color: var(--primary-dark);
  background: #ffffff;
  font-size: 13px;
  overflow-x: auto;
  white-space: nowrap;
}

.code-block,
.docs-code {
  margin: 0;
  overflow-x: auto;
  white-space: pre;
  word-spacing: normal;
  tab-size: 2;
}

.code-block {
  min-height: 132px;
  padding: 14px;
  border-radius: var(--radius-md);
  color: #dce7ff;
  background: #101827;
  font-size: 13px;
  line-height: 1.7;
}

/* API docs */
.docs-page {
  background:
    linear-gradient(180deg, rgba(228, 247, 244, 0.78), transparent 340px),
    var(--bg-page);
}

.docs-shell {
  width: min(1120px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.docs-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.docs-hero {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-md);
}

.docs-hero h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: 0;
}

.docs-hero p {
  max-width: 780px;
  margin: 0;
  color: var(--text-soft);
  line-height: 1.8;
}

.docs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.docs-nav,
.docs-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.docs-nav {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

.docs-nav a {
  padding: 9px 10px;
  border-radius: var(--radius-md);
  color: var(--text-soft);
  font-weight: 800;
}

.docs-nav a:hover {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.docs-content {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.docs-card {
  overflow-x: auto;
  padding: 22px;
}

.docs-card h2 {
  margin: 0 0 14px;
  font-size: 22px;
}

.docs-card h3 {
  margin: 18px 0 10px;
  font-size: 16px;
}

.docs-card p,
.docs-card li {
  color: var(--text-soft);
  line-height: 1.8;
}

.docs-card ul {
  margin: 0;
  padding-left: 20px;
}

.docs-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  overflow: hidden;
  font-size: 14px;
}

.docs-table th,
.docs-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.docs-table th {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  white-space: nowrap;
}

.docs-hero code,
.docs-table code,
.docs-card p code,
.docs-card li code {
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-family: var(--font-mono);
}

.docs-code {
  padding: 14px;
  border-radius: var(--radius-md);
  color: #dce7ff;
  background: #101827;
  font: 13px/1.7 var(--font-mono);
}

.docs-note {
  padding: 12px 14px;
  border: 1px solid #d7ece8;
  border-radius: var(--radius-md);
  color: #125c55;
  background: var(--teal-soft);
  line-height: 1.8;
}

/* Table */
.links-panel {
  min-height: 300px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.table-toolbar .panel-heading {
  margin-bottom: 0;
}

.table-search {
  position: relative;
  width: min(360px, 100%);
}

.table-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transform: translateY(-50%);
}

.table-search input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: #ffffff;
  outline: none;
}

.table-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(49, 87, 213, 0.10);
}

.url-table-wrapper {
  overflow-x: auto;
}

.url-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.url-table th {
  padding: 13px 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 900;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.url-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.url-table tbody tr:hover {
  background: #f9fbff;
}

.cell-short {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cell-short a,
.url-card-short {
  color: var(--primary-dark);
  font-family: var(--font-mono);
  font-weight: 900;
}

.cell-original {
  max-width: 430px;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-clicks {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--teal);
  background: var(--teal-soft);
  font-weight: 900;
}

.cell-clicks svg {
  width: 14px;
  height: 14px;
}

.cell-date {
  color: var(--text-muted);
  white-space: nowrap;
}

.cell-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text-soft);
  background: #ffffff;
}

.btn-icon:hover {
  color: var(--primary);
  border-color: #b9c8ff;
  background: var(--primary-soft);
}

.btn-icon.danger:hover {
  color: var(--danger);
  border-color: #ffc9cf;
  background: var(--danger-soft);
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

.url-card-list {
  display: none;
}

.url-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #ffffff;
}

.url-card-header,
.url-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.url-card-original {
  margin: 10px 0 14px;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.55;
  word-break: break-all;
}

.url-card-clicks {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 12px;
  font-weight: 900;
}

.url-card-clicks svg {
  width: 13px;
  height: 13px;
}

.url-card-date {
  color: var(--text-muted);
  font-size: 12px;
}

.url-card-actions {
  display: flex;
  gap: 8px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 18px;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text-soft);
  background: #ffffff;
  font-weight: 800;
}

.page-btn:hover:not(:disabled),
.page-btn.active {
  color: #ffffff;
  border-color: var(--primary);
  background: var(--primary);
}

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

.page-btn svg {
  width: 16px;
  height: 16px;
}

.page-ellipsis {
  color: var(--text-muted);
}

/* Loading / empty */
.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(4px);
}

.loading-text {
  color: var(--text-soft);
  font-weight: 700;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #d7e1ec;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.spinner-sm {
  width: 22px;
  height: 22px;
  border-width: 2px;
}

.empty-state {
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  color: var(--text-soft);
  text-align: center;
}

.empty-state svg {
  width: 54px;
  height: 54px;
  color: var(--text-muted);
}

.empty-state h3,
.empty-state h4 {
  margin: 0;
  color: var(--text-main);
}

.empty-state p {
  margin: 0;
  max-width: 360px;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: grid;
  gap: 12px;
  width: min(390px, calc(100vw - 40px));
}

.toast {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-md);
  animation: toastIn 180ms ease;
}

.toast.toast-exit {
  animation: toastOut 160ms ease forwards;
}

.toast-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  flex: 0 0 auto;
}

.toast-icon svg {
  width: 16px;
  height: 16px;
}

.toast-icon.success {
  color: var(--success);
  background: var(--success-soft);
}

.toast-icon.error {
  color: var(--danger);
  background: var(--danger-soft);
}

.toast-icon.warning {
  color: var(--amber);
  background: var(--amber-soft);
}

.toast-icon.info {
  color: var(--primary);
  background: var(--primary-soft);
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 900;
}

.toast-message {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.45;
}

.toast-close {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  background: transparent;
}

.toast-close:hover {
  color: var(--text-main);
  background: var(--bg-muted);
}

.toast-close svg {
  width: 15px;
  height: 15px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(-8px); }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(23, 32, 51, 0.42);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 160ms ease, visibility 160ms ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: min(440px, 100%);
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 18px;
  padding: 22px;
  border-radius: var(--radius-xl);
  background: #ffffff;
  box-shadow: var(--shadow-md);
  transform: translateY(8px);
  transition: transform 180ms ease;
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-hero {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  color: var(--primary);
  background: var(--primary-soft);
}

.modal-hero svg {
  width: 26px;
  height: 26px;
}

.modal-hero.danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.modal-main {
  min-width: 0;
}

.modal-main h3 {
  margin: 0;
  font-size: 21px;
  line-height: 1.28;
  letter-spacing: 0;
}

.modal-body {
  margin-top: 9px;
  color: var(--text-soft);
  line-height: 1.75;
}

.modal-body p {
  margin: 0;
}

.delete-code {
  display: block;
  min-width: 0;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid #ffd0d5;
  border-radius: var(--radius-md);
  color: #9f1d2a;
  background: #fff3f4;
  font-family: var(--font-mono);
  font-weight: 900;
  word-break: break-all;
}

.modal-note {
  display: block;
}

.modal-footer {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 2px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.modal-danger .btn-danger {
  color: #ffffff;
  border-color: var(--danger);
  background: var(--danger);
  box-shadow: 0 12px 22px rgba(217, 48, 62, 0.20);
}

.modal-danger .btn-danger:hover {
  background: #b92531;
}

/* Responsive */
@media (max-width: 980px) {
  .auth-shell {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 24px 0;
  }

  .auth-intro {
    min-height: auto;
    padding: 28px;
  }

  .auth-copy h1 {
    font-size: 34px;
  }

  .workspace-grid,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .api-panel-grid,
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .docs-nav {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .navbar {
    height: auto;
    padding: 12px 16px;
    align-items: flex-start;
    gap: 12px;
  }

  .navbar-user {
    gap: 8px;
  }

  .user-chip {
    display: none;
  }

  .dashboard-shell {
    width: min(100% - 24px, 1320px);
    padding-top: 20px;
  }

  .workspace-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace-header h1 {
    font-size: 27px;
  }

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

  .tool-panel,
  .auth-panel {
    padding: 18px;
  }

  .result-panel {
    grid-template-columns: 1fr;
  }

  .copy-line {
    flex-direction: column;
  }

  .table-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-search {
    width: 100%;
  }

  .url-table-wrapper {
    display: none;
  }

  .url-card-list {
    display: grid;
    gap: 12px;
  }

  .bar-chart {
    gap: 7px;
  }

  .bar-track {
    max-width: 34px;
  }

  .api-token-row {
    grid-template-columns: 1fr 1fr;
  }

  .api-token-row input {
    grid-column: 1 / -1;
  }

  .api-example-head,
  .docs-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .docs-nav {
    grid-template-columns: 1fr 1fr;
  }

  .docs-hero h1 {
    font-size: 28px;
  }

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

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .auth-shell {
    width: min(100% - 24px, 1080px);
  }

  .auth-intro {
    display: none;
  }

  .auth-panel {
    margin-top: 28px;
  }

  .brand-lockup {
    font-size: 15px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .stat-card {
    min-height: 96px;
  }

  .api-token-row,
  .docs-nav {
    grid-template-columns: 1fr;
  }

  .docs-shell {
    width: min(100% - 24px, 1120px);
  }

  .docs-card,
  .docs-hero {
    padding: 18px;
  }
}
