:root {
  color-scheme: light;
  --background: #fffaf5;
  --background-elevated: #ffffff;
  --background-card: #ffffff;
  --background-muted: #fff4e8;
  --foreground: #2f2114;
  --muted-foreground: #866e5a;
  --border: rgba(212, 133, 43, 0.18);
  --border-strong: rgba(212, 133, 43, 0.3);
  --primary: #ea7a16;
  --primary-foreground: #ffffff;
  --destructive: #d1495b;
  --destructive-soft: rgba(209, 73, 91, 0.12);
  --success: #2f9e61;
  --success-soft: rgba(47, 158, 97, 0.14);
  --warning: #d89b2b;
  --ring: rgba(234, 122, 22, 0.2);
  --shadow-lg: 0 28px 72px rgba(178, 126, 83, 0.14);
  --shadow-md: 0 16px 36px rgba(184, 132, 89, 0.12);
  --radius: 1rem;
  --radius-xs: 0.5rem;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --font-sans: "Segoe UI Variable Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "SF Mono", "Menlo", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--foreground);
  font-family: var(--font-sans);
  background: var(--background);
}

a {
  color: inherit;
}

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

button,
.button {
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms var(--ease-out);
}

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

button:active,
.button:active {
  transform: translateY(0);
}

button:disabled,
.button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
}

.notice {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 20;
  width: min(720px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid rgba(234, 122, 22, 0.22);
  border-radius: calc(var(--radius) - 2px);
  background: rgba(234, 122, 22, 0.1);
  color: #9a4d12;
  transform: translateX(-50%);
}

.notice.notice-error {
  border-color: rgba(209, 73, 91, 0.24);
  background: rgba(209, 73, 91, 0.1);
  color: #9b2439;
}

.task-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(47, 33, 20, 0.22);
  backdrop-filter: blur(8px);
}

.task-modal-card {
  display: grid;
  justify-items: center;
  gap: 18px;
  width: min(420px, calc(100vw - 40px));
  padding: 28px 24px 24px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.2);
  background: #fffdf9;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.task-modal-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(234, 122, 22, 0.18);
  border-top-color: var(--primary);
  border-radius: 999px;
  animation: spin 800ms linear infinite;
}

.task-modal-copy {
  display: grid;
  gap: 8px;
}

.task-modal-copy h2,
.task-modal-copy p {
  margin: 0;
}

.task-modal-copy h2 {
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.task-modal-copy p {
  color: var(--muted-foreground);
  line-height: 1.7;
}

.task-modal-card[data-tone="success"] .task-modal-spinner,
.task-modal-card[data-tone="error"] .task-modal-spinner {
  display: none;
}

.task-modal-card[data-tone="success"] .task-modal-copy h2 {
  color: var(--success);
}

.task-modal-card[data-tone="error"] .task-modal-copy h2 {
  color: var(--destructive);
}

.hidden {
  display: none;
}

.auth-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 20px;
}

.auth-card {
  display: grid;
  gap: 22px;
  width: min(460px, calc(100vw - 40px));
  padding: 36px 32px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.35);
  background: var(--background-card);
  box-shadow: var(--shadow-lg);
}

.auth-heading {
  display: grid;
  gap: 10px;
  justify-items: center;
  margin: 0;
  text-align: center;
}

.auth-heading h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.auth-heading p {
  margin: 0;
  color: var(--muted-foreground);
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 14px;
  width: 100%;
}

.auth-submit {
  width: 100%;
  margin-top: 8px;
}

.login-error {
  margin: 0;
  color: var(--destructive);
  line-height: 1.6;
}

.page-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 24px auto 56px;
}

.session-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.15);
  background: var(--background-elevated);
  box-shadow: var(--shadow-md);
}

.session-user {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.session-user strong {
  font-size: 1rem;
}

.session-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff4e8;
  color: var(--muted-foreground);
  font-size: 0.84rem;
}

.session-stats {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  grid-column: 2;
  justify-self: center;
  flex-wrap: wrap;
}

.session-bar > .button {
  grid-column: 3;
  justify-self: end;
  white-space: nowrap;
}

.session-stat {
  display: grid;
  gap: 2px;
  min-width: 120px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--background-muted);
}

.session-stat strong {
  font-size: 1.2rem;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.session-stat-label,
.session-stat-foot {
  color: var(--muted-foreground);
}

.session-stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.session-stat-foot {
  font-size: 0.82rem;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 24px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  background: var(--background-elevated);
  box-shadow: var(--shadow-lg);
}

.hero-footer {
  margin-top: 24px;
}

.hero-copy {
  display: grid;
  gap: 16px;
}

.hero-copy h1,
.panel-head h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.hero-copy h1 {
  font-size: clamp(2.6rem, 5vw, 4.6rem);
  line-height: 0.92;
  max-width: 10ch;
}

.hero-text {
  max-width: 60ch;
  margin: 0;
  color: var(--muted-foreground);
  line-height: 1.7;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 180px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.1);
  background: var(--background-card);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.74),
    0 16px 30px rgba(184, 132, 89, 0.1);
}

.stat-card strong {
  font-size: clamp(2.4rem, 4vw, 3.8rem);
  line-height: 1;
  letter-spacing: -0.06em;
}

.stat-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted-foreground);
}

.stat-foot {
  color: var(--muted-foreground);
  line-height: 1.5;
}

.tabbar-shell {
  position: sticky;
  top: 14px;
  z-index: 8;
  margin: 0 0 18px;
}

.tabbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.2);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-md);
}

.tab {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
}

.tab:hover {
  color: var(--primary);
  background: rgba(234, 122, 22, 0.08);
}

.tab.active {
  border-color: rgba(234, 122, 22, 0.22);
  background: rgba(234, 122, 22, 0.12);
  color: var(--primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: fade-up 220ms var(--ease-out);
}

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

.section-grid {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.panel {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.25);
  background: var(--background-card);
  box-shadow: var(--shadow-md);
}

.panel-feature {
  background: #fffdf9;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-heading {
  display: grid;
  gap: 2px;
}

.panel-head h2 {
  font-size: clamp(1.35rem, 2vw, 2.2rem);
  line-height: 1.05;
}

.stack-form,
.compact-list {
  display: grid;
  gap: 14px;
}

.site-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.compact-item,
.info-card {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background-muted);
}

.compact-item p,
.info-card p {
  margin: 0;
  color: var(--muted-foreground);
  line-height: 1.65;
}

.compact-item strong,
.info-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--foreground);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.empty-state {
  color: var(--muted-foreground);
}

.toolbar,
.button-row,
.form-grid {
  display: grid;
  gap: 14px;
}

.toolbar {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 18px;
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

.field span {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted-foreground);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: #ffffff;
  color: var(--foreground);
  outline: none;
}

.field input::placeholder,
.field textarea::placeholder {
  color: rgba(134, 110, 90, 0.76);
}

.field textarea {
  resize: vertical;
  min-height: 200px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(234, 122, 22, 0.36);
  box-shadow: 0 0 0 4px rgba(234, 122, 22, 0.12);
}

.button-row {
  grid-template-columns: repeat(auto-fit, minmax(170px, max-content));
  align-items: center;
}

.button-head-action {
  min-height: 40px;
  padding: 0 18px;
  white-space: nowrap;
}

.site-card {
  display: grid;
  justify-items: start;
  gap: 6px;
  min-height: 108px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  text-align: left;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 8px 20px rgba(184, 132, 89, 0.08);
}

.site-card:hover {
  border-color: rgba(234, 122, 22, 0.22);
  background: #fff8f1;
}

.site-card.active {
  border-color: rgba(234, 122, 22, 0.32);
  background: #fff1e3;
  box-shadow:
    0 0 0 1px rgba(234, 122, 22, 0.12),
    0 18px 36px rgba(184, 132, 89, 0.14);
}

.site-card strong,
.site-card span {
  display: block;
}

.site-card strong {
  color: var(--foreground);
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.site-card span {
  color: var(--muted-foreground);
  line-height: 1.5;
  font-size: 0.88rem;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.button-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 16px 32px rgba(234, 122, 22, 0.2);
}

.button-primary:hover {
  background: #d96f10;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.88);
  border-color: var(--border-strong);
  color: var(--foreground);
}

.button-secondary:hover {
  background: #fff8f1;
}

.button-ghost {
  background: rgba(255, 255, 255, 0.56);
  border-color: var(--border);
  color: var(--muted-foreground);
}

.button-ghost:hover {
  color: var(--primary);
  background: rgba(234, 122, 22, 0.08);
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: #ffffff;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: transparent;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff4e8;
  color: var(--muted-foreground);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}

tbody tr {
  transition: background-color 180ms ease;
}

tbody tr:hover {
  background: rgba(234, 122, 22, 0.05);
}

.table-link {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  color: #c86410;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-link:hover {
  color: #9f4f0f;
}

.code-inline {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff4e8;
  color: #8c5d32;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.status-available,
.status-success {
  color: var(--success);
  border-color: rgba(47, 158, 97, 0.18);
  background: var(--success-soft);
}

.status-unavailable,
.status-failed {
  color: var(--destructive);
  border-color: rgba(209, 73, 91, 0.18);
  background: var(--destructive-soft);
}

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

.mini-actions-nowrap {
  flex-wrap: nowrap;
}

.mini-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.86);
  color: var(--foreground);
  font-size: 0.88rem;
  white-space: nowrap;
}

.mini-button:hover {
  border-color: var(--border-strong);
  background: #fff8f1;
}

.mini-button.danger {
  color: #b4233d;
  border-color: rgba(209, 73, 91, 0.2);
  background: rgba(209, 73, 91, 0.08);
}

.mini-button.success {
  color: #21734a;
  border-color: rgba(47, 158, 97, 0.2);
  background: rgba(47, 158, 97, 0.08);
}

.meta-text {
  display: inline-block;
  color: var(--muted-foreground);
  line-height: 1.6;
}

.links-table {
  table-layout: fixed;
}

.links-col-created {
  width: 88px;
}

.links-col-url {
  width: 260px;
}

.links-col-domain {
  width: 164px;
}

.links-col-status {
  width: 104px;
  white-space: nowrap;
}

.links-col-note {
  width: 150px;
}

.links-col-note .meta-text {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.links-col-action {
  width: 128px;
  white-space: nowrap;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .hero {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 920px) {
  .hero-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 20px, 1480px);
    margin-top: 12px;
    margin-bottom: 28px;
  }

  .auth-card,
  .hero,
  .panel,
  .session-bar {
    padding: 18px;
    border-radius: calc(var(--radius) * 1.1);
  }

  .session-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .session-user,
  .session-stats {
    width: 100%;
  }

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

  .session-bar > .button {
    justify-self: auto;
  }

  .hero-copy h1 {
    max-width: none;
    font-size: clamp(2.1rem, 11vw, 3rem);
  }

  .tabbar-shell {
    top: 10px;
  }

  .tabbar {
    padding: 6px;
    border-radius: calc(var(--radius) + 2px);
  }

  .tab {
    width: calc(50% - 4px);
    justify-content: center;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .button-head-action {
    width: 100%;
  }

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

  .table-link {
    max-width: 220px;
  }
}
