:root {
  color-scheme: light;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5f5;
  --text: #0f172a;
  --text-muted: #475569;
  --accent: #134074;
  --accent-light: #1f5d9d;
  --accent-soft: #e7eff6;
  --danger: #ef4444;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f1f5f9 0%, #ffffff 30%, #f1f5f9 100%);
  color: var(--text);
}

.app__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: "Montserrat", sans-serif;
}

.logo {
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
}

.badge--success {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.badge--muted {
  background: rgba(148, 163, 184, 0.12);
  color: #64748b;
}

.toolbar {
  display: flex;
  gap: 0.5rem;
}

.toolbar__btn {
  border: none;
  background: transparent;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.2s ease, color 0.2s ease;
}
.toolbar[hidden] {
  display: none !important;
}

.toolbar__btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}


.toolbar__btn:hover {
  background: rgba(19, 64, 116, 0.08);
  color: var(--accent);
}

.toolbar__btn--active {
  background: rgba(19, 64, 116, 0.12);
  color: var(--accent);
}

.toolbar__btn--danger {
  color: var(--danger);
}

.app__main {
  max-width: 1240px;
  margin: 2rem auto;
  padding: 0 2rem 4rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 25px 45px -35px rgba(15, 23, 42, 0.2);
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 1.75rem;
  margin-bottom: 2rem;
}

.card--center {
  max-width: 420px;
  margin: 6rem auto;
  text-align: center;
}

.card__header {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.4rem;
}

.card__title {
  margin: 1.5rem 0 0.75rem;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

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

.section__header h2 {
  margin: 0;
  font-size: 1.85rem;
}

.section__header p {
  margin: 0;
  color: var(--text-muted);
}

.section__actions {
  display: flex;
  gap: 0.5rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form--inline {
  margin-top: 1.5rem;
}

.form__label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
  font-weight: 500;
}

.form__input, textarea, select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font: inherit;
  background: var(--surface-muted);
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.form__input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(19, 64, 116, 0.5);
  box-shadow: 0 0 0 3px rgba(19, 64, 116, 0.16);
}

.form__input:disabled,
textarea:disabled,
select:disabled {
  background: var(--surface-muted);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 1;
}

.form__input[readonly] {
  background: var(--surface-muted);
  color: var(--text-muted);
  cursor: not-allowed;
}

textarea {
  resize: vertical;
  min-height: 110px;
}

.form__checkbox {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.form__actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  align-items: center;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: var(--surface);
  box-shadow: 0 15px 35px -20px rgba(19, 64, 116, 0.8);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 38px -20px rgba(19, 64, 116, 0.95);
}

.btn-secondary {
  background: rgba(19, 64, 116, 0.08);
  color: var(--accent);
}

.btn-secondary:hover {
  background: rgba(19, 64, 116, 0.16);
}

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

.btn--small {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

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

.grid--dashboard {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.summary-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 1.5rem;
  border: 1px solid rgba(19, 64, 116, 0.08);
  box-shadow: 0 18px 40px -30px rgba(19, 64, 116, 0.35);
}

.summary-card__label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  margin-bottom: 0.45rem;
}

.summary-card__value {
  font-size: 2rem;
  font-family: "Montserrat", sans-serif;
}

.table {
  overflow-x: auto;
}

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

.table th,
.table td {
  padding: 0.9rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.table th {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
}

.table__header {
  display: flex;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  border-bottom: 2px solid var(--border);
  letter-spacing: 0.05em;
}

.table__row {
  display: flex;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background-color 0.15s ease;
}

.table__row:hover {
  background-color: var(--surface-muted);
}

.table__row:last-child {
  border-bottom: none;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.list-item {
  background: var(--surface-muted);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.list-item__content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.list-item__title {
  font-weight: 600;
}

.list-item__meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.list-item__actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.list-item--active {
  border-color: rgba(19, 64, 116, 0.4);
  background: rgba(19, 64, 116, 0.12);
}

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.muted {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0.5rem 0 1.5rem;
}

.toast {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  padding: 0.8rem 1.2rem;
  background: rgba(19, 64, 116, 0.95);
  color: var(--surface);
  border-radius: 12px;
  box-shadow: 0 20px 40px -20px rgba(15, 23, 42, 0.45);
}

.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  color: var(--text-muted);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spinner 0.8s linear infinite;
}

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

@media (max-width: 768px) {
  .app__main {
    padding: 0 1.25rem 3rem;
  }
  .toolbar {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .card {
    padding: 1.3rem;
  }
}

.card--license {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card--license .placeholder {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
}

.license-status {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.license-status--trial {
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
}

.license-status--lite {
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
}

.license-status--pro {
  background: rgba(133, 77, 255, 0.14);
  color: #5b21b6;
}

.license-status--attention {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}

.license-meta {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--text-muted);
}

.license-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.license-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.license-card__body {
  display: grid;
  gap: 1.2rem;
}

.license-summary {
  display: grid;
  gap: 0.45rem;
  margin: 0;
}

.license-summary__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.license-summary__row dt {
  font-weight: 500;
}

.license-summary__row dd {
  margin: 0;
  font-weight: 600;
  color: var(--text);
}

.license-total {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.license-total strong {
  font-size: 1.4rem;
  color: var(--accent);
}

.license-total__hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.license-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.btn-upgrade {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: var(--surface);
}

.btn-danger {
  background: rgba(220, 38, 38, 0.16);
  color: #b91c1c;
}

.btn-danger:hover {
  background: rgba(220, 38, 38, 0.26);
}

.stat-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  padding-bottom: 0.6rem;
}

.stat-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.stat-value {
  font-size: 1.8rem;
  font-family: "Montserrat", sans-serif;
}

.stat-label {
  color: var(--text-muted);
}

.form--compact .form__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
  margin-bottom: 0.9rem;
}

.form__hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.license-note {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.license-note--warning {
  color: #b91c1c;
}

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

/* Modal styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
}

.modal__content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  z-index: 1;
}

.modal__header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal__header h3 {
  margin: 0;
}

.modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 0;
  width: 2rem;
  height: 2rem;
}

.modal__close:hover {
  color: var(--text-primary);
}

.modal__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1.5rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  margin-top: 1.5rem;
}

.modal .form {
  padding: 1.5rem;
}

/* Toggle Switch */
.list-item--toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.list-item--toggle:last-child {
  border-bottom: none;
}

.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: 0.3s;
  border-radius: 26px;
}

.toggle__slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle input:checked + .toggle__slider {
  background-color: var(--accent);
}

.toggle input:focus + .toggle__slider {
  box-shadow: 0 0 1px var(--accent);
}

.toggle input:checked + .toggle__slider:before {
  transform: translateX(22px);
}

/* Mobile hamburger menu */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 20;
}

.mobile-menu-toggle span {
  width: 100%;
  height: 3px;
  background: var(--accent);
  border-radius: 10px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

.mobile-menu-toggle[hidden] {
  display: none !important;
}

@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }

  .toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 15;
  }

  .toolbar.mobile-open {
    opacity: 1;
    pointer-events: all;
  }

  .toolbar__btn {
    font-size: 1.2rem;
    padding: 1rem 2rem;
    width: 100%;
    max-width: 300px;
    text-align: center;
  }
}
