:root,
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f1ec;
  --bg-strong: #ffffff;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-border: rgba(0, 0, 0, 0.08);
  --line: rgba(0, 0, 0, 0.08);
  --text: #101010;
  --muted: #616161;
  --accent: #171717;
  --accent-soft: rgba(0, 0, 0, 0.05);
  --success: #e8f4eb;
  --error: #f9e5e5;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111213;
  --bg-strong: #17191a;
  --panel: rgba(24, 26, 28, 0.92);
  --panel-border: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f4f4f0;
  --muted: #aaaaa5;
  --accent: #f4f4f0;
  --accent-soft: rgba(255, 255, 255, 0.06);
  --success: rgba(73, 121, 88, 0.25);
  --error: rgba(145, 74, 74, 0.28);
  --shadow: 0 28px 96px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(140, 140, 140, 0.14), transparent 24%),
    linear-gradient(180deg, var(--bg-strong) 0%, var(--bg) 100%);
  color: var(--text);
}

html,
body {
  background-color: var(--bg);
}

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

button,
.button-link {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1.15rem;
  background: var(--accent);
  color: var(--bg-strong);
  cursor: pointer;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

html[data-theme="dark"] button,
html[data-theme="dark"] .button-link {
  color: #121212;
}

.button-link.secondary,
button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  padding: 2rem;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.sidebar h1,
.page-header h2,
.auth-card h1 {
  margin: 0.4rem 0 0;
  font-size: clamp(1.8rem, 2vw, 2.3rem);
}

.nav {
  display: grid;
  gap: 0.5rem;
}

.nav a {
  padding: 0.9rem 1rem;
  border-radius: 18px;
  color: var(--muted);
}

.nav a.active,
.nav a:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.content {
  padding: 2rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.theme-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 90%, transparent);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-size: 0.75rem;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  border-radius: 28px;
  padding: 1.5rem;
}

.panel-head,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.stats-grid,
.two-column {
  display: grid;
  gap: 1.25rem;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 1.25rem;
}

.stat-card {
  background: linear-gradient(180deg, rgba(22, 22, 22, 0.98), rgba(35, 35, 35, 0.98));
  color: white;
  border-radius: 28px;
  padding: 1.5rem;
  min-height: 148px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

html[data-theme="dark"] .stat-card {
  background: linear-gradient(180deg, rgba(235, 235, 228, 0.95), rgba(200, 200, 194, 0.95));
  color: #111;
}

.stat-card span {
  color: rgba(255, 255, 255, 0.7);
}

html[data-theme="dark"] .stat-card span {
  color: rgba(17, 17, 17, 0.65);
}

.stat-card strong {
  font-size: 2rem;
}

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

.detail-sections {
  margin-top: 1.5rem;
}

.currency-list,
.stack {
  display: grid;
  gap: 1rem;
}

.currency-item,
.renewal-card,
.vendor-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.vendor-list {
  display: grid;
  gap: 0.85rem;
}

.vendor-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1rem 1.1rem;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
}

.vendor-main,
.vendor-detail-head {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.vendor-copy {
  display: grid;
  gap: 0.3rem;
}

.vendor-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-strong) 88%, transparent);
}

.vendor-logo.large {
  width: 72px;
  height: 72px;
  border-radius: 20px;
}

.vendor-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.vendor-tags.inline {
  justify-content: flex-start;
  margin-top: 0.65rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.38rem 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.8rem;
}

.inline-actions {
  margin-top: 0.85rem;
}

.renewal-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.9rem 0.6rem;
  border-bottom: 1px solid var(--line);
}

input,
select,
textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-strong) 88%, transparent);
  color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

label {
  display: grid;
  gap: 0.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.full-span {
  grid-column: 1 / -1;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.detail-grid > div,
.full-width,
.compact-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.85rem 0.95rem;
  min-height: 74px;
}

.compact-grid > div {
  min-height: 66px;
}

.detail-grid span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.detail-grid strong {
  font-size: 0.95rem;
  line-height: 1.5;
}

.pre-wrap {
  white-space: pre-wrap;
  word-break: break-word;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.check-card,
.mode-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
}

.check-card input,
.mode-card input {
  width: auto;
  margin: 0;
}

.settings-card {
  display: grid;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1rem 1.1rem;
  background: color-mix(in srgb, var(--panel) 86%, transparent);
}

.settings-card strong {
  font-size: 1rem;
}

.flash {
  padding: 1rem 1.2rem;
  border-radius: 18px;
  margin-bottom: 1rem;
}

.flash.success {
  background: var(--success);
}

.flash.error {
  background: var(--error);
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.auth-card {
  width: min(520px, 100%);
  background: var(--panel);
  box-shadow: var(--shadow);
  border-radius: 28px;
  padding: 2rem;
}

.full {
  width: 100%;
}

.hidden-field {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.modal-panel {
  width: min(720px, 100%);
  max-height: calc(100vh - 3rem);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.5rem 0;
}

@media (max-width: 960px) {
  .shell,
  .stats-grid,
  .two-column,
  .form-grid,
  .detail-grid,
  .check-grid {
    grid-template-columns: 1fr;
  }

  .page-header,
  .panel-head,
  .renewal-card,
  .actions,
  .vendor-list-item,
  .vendor-main,
  .vendor-detail-head {
    flex-direction: column;
    align-items: stretch;
  }

  .vendor-tags {
    justify-content: flex-start;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
