:root {
  color-scheme: dark;
  --canvas: #000;
  --surface: #111;
  --surface-2: #151515;
  --surface-3: #202020;
  --line: #292929;
  --line-strong: #393939;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --accent: #00e676;
  --accent-ink: #00160b;
  --teal: #00e676;
  --danger: #ff7168;
  --warning: #f7bc58;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.65);
  --radius: 6px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--text);
}

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

button {
  color: inherit;
}

.loading-screen,
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.loading-screen {
  align-content: center;
  color: var(--muted);
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 900;
  font-size: 0.72rem;
  letter-spacing: -0.04em;
  box-shadow: none;
}

.auth-card {
  width: min(100%, 440px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #111;
  box-shadow: var(--shadow);
}

.auth-logo {
  display: block;
  width: min(240px, 72vw);
  height: auto;
  margin: 0 auto 24px;
  object-fit: contain;
}

.auth-text-button {
  display: block;
  margin: 14px auto 0;
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
}

.auth-text-button:hover {
  text-decoration: underline;
}

.success-box {
  margin-bottom: 18px;
  padding: 13px 14px;
  border: 1px solid rgba(0, 230, 118, 0.35);
  border-radius: var(--radius);
  background: rgba(0, 230, 118, 0.08);
  color: #b8ffd8;
  line-height: 1.5;
}

.password-requests {
  margin-bottom: 16px;
  border-color: rgba(247, 188, 88, 0.35);
}

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

.system-card {
  margin-bottom: 16px;
}

.error-detail {
  max-width: 360px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
}

.account-settings-card {
  max-width: 620px;
}

.auth-card .brand-mark {
  margin-bottom: 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 9px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -0.045em;
}

h2 {
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

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

.subcopy {
  margin-bottom: 28px;
  line-height: 1.6;
}

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

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

label {
  display: grid;
  gap: 8px;
  color: #c8d0d6;
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  outline: none;
  background: #101010;
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea {
  min-height: 120px;
  padding-top: 12px;
  resize: vertical;
}

input:focus,
select:focus {
  border-color: rgba(184, 243, 74, 0.7);
  box-shadow: 0 0 0 3px rgba(184, 243, 74, 0.1);
}

.button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: #222;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 800;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.button.primary {
  border-color: var(--accent);
  background: transparent;
  color: var(--accent);
}

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

.button.ghost {
  border-color: var(--line);
  background: transparent;
}

.auth-card .button.primary {
  width: 100%;
  margin-top: 22px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 25px 18px;
  border-right: 1px solid var(--line);
  background: #050505;
}

.brand-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 32px;
}

.brand-row strong {
  display: block;
  color: var(--accent);
  font-size: 1rem;
}

.brand-row span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.7rem;
}

.nav {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 5px;
  padding-right: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.nav::-webkit-scrollbar {
  width: 6px;
}

.nav::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: var(--line-strong);
}

.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 750;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  background: #061b10;
  color: var(--accent);
}

.nav-button.active::before {
  content: none;
}

.nav-icon {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.7rem;
}

.sidebar-footer {
  flex: 0 0 auto;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.account-chip {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0d0d0d;
}

.account-chip strong,
.account-chip span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-chip strong {
  font-size: 0.82rem;
}

.account-chip span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: capitalize;
}

.logout-link {
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.76rem;
}

.main {
  min-width: 0;
  padding: 28px clamp(22px, 4vw, 56px) 60px;
}

.topbar,
.section-heading,
.card-heading,
.modal-heading,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  min-height: 48px;
  margin-bottom: 38px;
}

.mobile-menu {
  display: none;
}

.credit-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(184, 243, 74, 0.2);
  border-radius: 4px;
  background: #061b10;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
}

.credit-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 15px var(--accent);
}

.page-intro {
  margin-bottom: 28px;
}

.page-intro p {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

.metric,
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #111;
}

.metric {
  position: relative;
  overflow: hidden;
  min-height: 142px;
  padding: 20px;
}

.metric::after {
  content: none;
}

.metric-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.metric-value {
  display: block;
  margin: 24px 0 8px;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.06em;
}

.metric-detail {
  color: var(--teal);
  font-size: 0.7rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 18px;
}

.card {
  overflow: hidden;
}

.card-heading {
  min-height: 64px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.card-heading h2 {
  margin: 0;
}

.card-body {
  padding: 20px;
}

.quick-actions {
  display: grid;
  gap: 10px;
}

.quick-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #141414;
  cursor: pointer;
  text-align: left;
}

.quick-action strong,
.quick-action span {
  display: block;
}

.quick-action strong {
  font-size: 0.83rem;
}

.quick-action span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.7rem;
}

.quick-action b {
  color: var(--accent);
  font-size: 1.1rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.78rem;
}

th {
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.identity strong,
.identity span {
  display: block;
}

.identity strong {
  font-size: 0.8rem;
}

.identity span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.68rem;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 3px;
  background: rgba(83, 218, 192, 0.08);
  color: var(--teal);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: capitalize;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status.suspended,
.status.error {
  background: rgba(255, 113, 104, 0.08);
  color: var(--danger);
}

.status.provisioning,
.status.expired {
  background: rgba(247, 188, 88, 0.08);
  color: var(--warning);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.icon-button {
  min-width: 34px;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #181818;
  cursor: pointer;
  font-size: 0.7rem;
}

.empty-state {
  padding: 48px 20px;
  color: var(--muted);
  text-align: center;
}

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

.plan-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.plan-card h2 {
  margin-bottom: 6px;
}

.plan-cost {
  margin: 22px 0;
  font-size: 2.1rem;
  font-weight: 900;
  letter-spacing: -0.06em;
}

.plan-cost small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: normal;
}

.plan-facts {
  display: grid;
  gap: 9px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.76rem;
}

.term-list {
  display: grid;
  gap: 7px;
  margin: 18px 0;
}

.term-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #0b0b0b;
  color: var(--text);
  text-align: left;
}

.term-row:not(:disabled) {
  cursor: pointer;
}

.term-row strong,
.term-row small {
  display: block;
}

.term-row small {
  margin-top: 3px;
  color: var(--muted);
}

.term-row b {
  color: var(--accent);
}

dialog {
  width: min(94vw, 540px);
  max-height: 92vh;
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.82);
}

.modal-heading {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-heading h2 {
  margin: 0;
}

.modal-body {
  padding: 22px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 10px;
}

.toast {
  max-width: 380px;
  padding: 13px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #171717;
  box-shadow: var(--shadow);
  font-size: 0.8rem;
}

.toast.error {
  border-color: rgba(255, 113, 104, 0.4);
}

.credentials {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0;
}

.credential {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #090909;
}

.credential span,
.credential strong {
  display: block;
}

.credential span {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
}

.warning-box {
  padding: 14px 15px;
  border: 1px solid rgba(247, 188, 88, 0.38);
  border-radius: 4px;
  background: rgba(247, 188, 88, 0.08);
  color: #f5cc84;
  font-size: 0.78rem;
  line-height: 1.55;
}

.danger-warning {
  border-color: rgba(255, 113, 104, 0.45);
  background: rgba(255, 113, 104, 0.08);
  color: #ffd2cf;
}

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

.bulk-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.directory-search {
  display: grid;
  grid-template-columns: auto minmax(220px, 520px) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.directory-search label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.directory-search input {
  min-width: 0;
  height: 40px;
  padding: 0 12px;
}

.directory-search span {
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.bulk-toolbar > span {
  margin-right: auto;
  color: var(--muted);
}

.check-cell {
  width: 38px;
  text-align: center;
}

.check-cell input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.ticket-list {
  display: grid;
  gap: 10px;
}

.ticket-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.ticket-row:hover,
.ticket-row.unread {
  border-color: rgba(0, 230, 118, 0.55);
}

.ticket-main,
.ticket-main small {
  display: block;
}

.ticket-main small {
  margin-top: 5px;
  color: var(--muted);
}

.ticket-badges,
.ticket-summary,
.ticket-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.ticket-badges b {
  color: var(--accent);
  font-size: 12px;
}

.ticket-thread {
  display: grid;
  gap: 10px;
  margin: 16px 0;
  max-height: 42vh;
  overflow: auto;
}

.ticket-reply {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.ticket-reply.owner-reply {
  border-left: 3px solid var(--accent);
}

.ticket-reply > div {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  color: var(--muted);
  font-size: 12px;
}

.ticket-reply p {
  margin: 9px 0 0;
  white-space: pre-wrap;
}

.ticket-controls {
  justify-content: flex-end;
  margin-top: 12px;
}

@media (max-width: 700px) {
  .ticket-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

.message-item {
  padding: 20px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 5px;
  background: #111;
}

.message-item.unread {
  border-left-color: var(--accent);
  background: #07130c;
}

.message-item.warning {
  border-left-color: var(--warning);
}

.message-item.urgent {
  border-left-color: var(--danger);
}

.message-item p {
  color: #c7c7c7;
  line-height: 1.65;
  white-space: pre-wrap;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.72rem;
}

@media (max-width: 1000px) {
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    width: 280px;
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu {
    display: inline-grid;
    place-items: center;
  }

  .main {
    padding: 20px 16px 50px;
  }

  .topbar {
    margin-bottom: 26px;
  }

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

  .compact-metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .auth-card {
    padding: 26px 20px;
  }

  .form-grid,
  .metrics,
  .credentials {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .main {
    padding: 16px 10px 40px;
  }

  .button,
  .icon-button {
    min-height: 42px;
  }

  .modal-heading,
  .modal-body {
    padding: 16px;
  }

  .bulk-toolbar .button {
    flex: 1 1 calc(50% - 8px);
  }

  .directory-search {
    grid-template-columns: 1fr auto;
  }

  .directory-search label {
    grid-column: 1 / -1;
  }
}
