:root {
  color-scheme: light;
  --background: #ffffff;
  --foreground: #20232b;
  --primary: #1d55d3;
  --primary-hover: #1949b8;
  --primary-foreground: #ffffff;
  --secondary: #f1f4f7;
  --secondary-hover: #e7ebf0;
  --muted: #f3f5f7;
  --muted-foreground: #606773;
  --accent: #edf1f5;
  --border: #dce1e7;
  --ring: rgba(29, 85, 211, 0.3);
  --destructive: #dc2626;
  --radius: 0.5rem;
}

* {
  box-sizing: border-box;
  border-color: var(--border);
}

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

body {
  background: var(--muted);
  color: var(--foreground);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.clipboard-fallback {
  position: fixed;
  left: -10000px;
  top: 0;
}

.center-page,
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.muted-page {
  background: rgba(243, 245, 247, 0.6);
}

.state-card {
  width: min(100%, 24rem);
  padding: 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--muted-foreground);
  text-align: center;
  font-size: 0.875rem;
}

.error-card h1 {
  margin: 0.75rem 0 0;
  color: var(--foreground);
  font-size: 1.125rem;
}

.error-card p {
  margin: 0.5rem 0 1.25rem;
}

.state-icon {
  width: 2rem;
  height: 2rem;
  fill: none;
  stroke: var(--destructive);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-page {
  background:
    radial-gradient(circle at top left, #e8f0ff, transparent 34%),
    linear-gradient(135deg, #eef2ff, #f8fafc 52%, #eefcf6);
}

.login-card {
  width: min(100%, 24rem);
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
}

.login-heading {
  margin-bottom: 1.75rem;
}

.login-icon {
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  background: var(--primary);
  color: var(--primary-foreground);
}

.login-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.login-heading h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.login-heading p,
.account-heading p,
.profile-heading p,
.section-heading p {
  margin: 0.25rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

input {
  width: 100%;
  height: 2.25rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  outline: none;
  background: var(--background);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  font-size: 0.875rem;
}

input:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

input:disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.code-field {
  margin-top: 1rem;
}

.login-submit {
  margin-top: 1.25rem;
}

.login-actions {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.button {
  min-height: 2.25rem;
  padding: 0.5rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 0.375rem;
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

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

.button-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.button-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.button-secondary {
  background: var(--secondary);
  color: var(--foreground);
}

.button-secondary:hover:not(:disabled) {
  background: var(--secondary-hover);
}

.button-outline {
  border-color: var(--border);
  background: var(--background);
}

.button-outline:hover:not(:disabled),
.button-ghost:hover:not(:disabled) {
  background: var(--accent);
}

.button-ghost {
  background: transparent;
}

.button-full {
  width: 100%;
}

.button-small {
  min-height: 2rem;
  padding: 0.375rem 0.75rem;
}

.icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-primary {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--primary);
}

.dashboard-page {
  min-height: 100vh;
  padding: 1rem;
  background: rgba(243, 245, 247, 0.6);
}

.dashboard-shell {
  width: min(100%, 64rem);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.dashboard-header,
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
}

.dashboard-header {
  min-width: 0;
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.account-heading,
.truncate {
  min-width: 0;
}

.account-heading p,
.profile-heading p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.title-row h1 {
  margin: 0;
  overflow: hidden;
  font-size: 1.125rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-grid {
  display: grid;
  gap: 1rem;
}

.profile-card,
.subscriptions-card,
.quick-card {
  padding: 1.25rem;
}

.profile-heading,
.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.profile-heading h2,
.section-heading h2,
.quick-card h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.profile-heading h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  color: #047857;
  background: #ecfdf5;
  box-shadow: inset 0 0 0 1px #a7f3d0;
}

.badge-outline {
  border: 1px solid var(--border);
  background: var(--background);
}

.rule-card {
  margin-bottom: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: rgba(243, 245, 247, 0.4);
  font-size: 0.875rem;
}

.rule-card span {
  color: var(--muted-foreground);
}

.rule-card p {
  margin: 0.25rem 0 0;
  font-weight: 500;
}

.qr-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: #ffffff;
}

.qr-card img,
.qr-placeholder {
  width: 14rem;
  height: 14rem;
  margin: 0 auto;
}

.qr-card img {
  display: block;
}

.qr-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.profile-copy {
  margin-top: 1rem;
}

.content-column,
.subscription-list {
  display: grid;
  gap: 1rem;
}

.subscription-list {
  gap: 0.75rem;
}

.subscription-item {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background: rgba(243, 245, 247, 0.3);
  cursor: pointer;
  text-align: left;
}

.subscription-item:hover {
  background: var(--accent);
}

.subscription-item span {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.subscription-item code {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted-foreground);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.75rem;
}

.quick-actions {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.toast {
  position: fixed;
  z-index: 80;
  top: 1rem;
  right: 1rem;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.16);
  font-size: 0.875rem;
  font-weight: 500;
}

.toast-success {
  background: #059669;
}

.toast-error {
  background: var(--destructive);
}

@media (min-width: 640px) {
  .login-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (min-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 360px minmax(0, 1fr);
  }
}
