/* DiTONEX client portal — reference layout + app extensions */

*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --bg: #0f1117;
  --surface: #181b24;
  --surface-raised: #1e2230;
  --border: rgba(255, 255, 255, 0.07);
  --border-active: rgba(255, 255, 255, 0.14);
  --text-primary: #f0f2f7;
  --text-secondary: #8b90a0;
  --text-muted: #545870;
  --accent: #4f7cff;
  --accent-soft: rgba(79, 124, 255, 0.12);
  --accent-glow: rgba(79, 124, 255, 0.25);
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.1);
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 10px;
  --radius-lg: 16px;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.mono, .domain, .code {
  font-family: "DM Mono", ui-monospace, Menlo, Monaco, Consolas, monospace;
}

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

/* ----- Layout ----- */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ----- Sidebar ----- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 30px;
  height: 30px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.5px;
}

.logo-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.logo-tld {
  color: var(--text-muted);
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
  overflow: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 8px 10px 6px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  margin-bottom: 1px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.nav-icon {
  width: 16px;
  height: 16px;
  opacity: 0.8;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4f7cff, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}

.avatar-info {
  flex: 1;
  min-width: 0;
}

.avatar-name,
.avatar-meta .name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar-role,
.avatar-meta .role {
  font-size: 11px;
  color: var(--text-muted);
}

.avatar-meta .role.mono {
  font-family: "DM Mono", monospace;
}

/* ----- Main ----- */
.main {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - 240px);
}

/* ----- Topbar ----- */
.topbar {
  height: 57px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 12px;
  position: sticky;
  top: 0;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  z-index: 5;
}

.topbar-breadcrumb,
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.topbar-breadcrumb span:not(.sep),
.breadcrumb strong {
  color: var(--text-primary);
  font-weight: 500;
}

.topbar-breadcrumb .sep,
.breadcrumb span.mono {
  color: var(--text-muted);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-family: "DM Sans", sans-serif;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}

button.btn {
  font: inherit;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-active);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #3d6ef0;
}

/* ----- Content ----- */
.flash-stack {
  padding: 12px 32px 0;
}

.flash {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.flash + .flash {
  margin-top: 8px;
}

.flash-success {
  background: var(--green-soft);
  border-color: rgba(52, 211, 153, 0.25);
  color: var(--text-primary);
}

.flash-error {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.25);
  color: var(--text-primary);
}

.flash-info {
  background: var(--accent-soft);
  border-color: rgba(79, 124, 255, 0.25);
  color: var(--text-primary);
}

.content {
  padding: 36px 32px;
  flex: 1;
}

.page {
  animation: fadeUp 0.4s ease both;
}

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

.page-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.4px;
  margin: 0 0 4px;
}

.page-sub {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ----- Service card (reference) ----- */
.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 760px;
  margin-bottom: 20px;
  animation: fadeUp 0.4s ease both;
}

.service-card:nth-child(1) {
  animation-delay: 0s;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.service-icon {
  width: 42px;
  height: 42px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-glow);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.service-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.service-domain {
  font-family: "DM Mono", monospace;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.2);
  flex-shrink: 0;
}

.status-pill.amber {
  background: rgba(251, 191, 36, 0.1);
  color: var(--amber);
  border-color: rgba(251, 191, 36, 0.2);
}

.status-pill.amber .status-dot {
  background: var(--amber);
}

.status-pill.red {
  background: rgba(248, 113, 113, 0.1);
  color: var(--red);
  border-color: rgba(248, 113, 113, 0.2);
}

.status-pill.red .status-dot {
  background: var(--red);
}

.status-pill.grey {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border-color: var(--border);
}

.status-pill.grey .status-dot {
  background: var(--text-muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.card-body {
  padding: 24px;
}

.plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--surface-raised);
  border: 1px solid var(--border-active);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.plan-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.plan-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.plan-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.plan-price-block {
  text-align: right;
}

.price-amount {
  font-size: 36px;
  font-weight: 300;
  color: var(--text-primary);
  letter-spacing: -1.5px;
  line-height: 1;
}

.price-amount .price-currency {
  font-size: 20px;
  font-weight: 400;
  vertical-align: super;
  margin-right: 1px;
}

.price-amount .price-pence {
  font-size: 20px;
  font-weight: 400;
}

.price-period {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}

/* Legacy .price block (other pages) */
.price {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-weight: 300;
  letter-spacing: -1.5px;
}

.price .currency {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 400;
  vertical-align: super;
  letter-spacing: 0;
}

.price .pounds {
  font-size: 36px;
  line-height: 1;
}

.price .pence {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-secondary);
}

.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}

.detail-cell {
  background: var(--surface);
  padding: 14px 18px;
}

.detail-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.detail-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.detail-value.mono {
  font-family: "DM Mono", monospace;
  font-size: 13px;
}

.detail-value.green {
  color: var(--green);
}

.detail-value.amber {
  color: var(--amber);
}

.detail-value.red {
  color: var(--red);
}

.invoice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  background: rgba(79, 124, 255, 0.06);
  border: 1px solid rgba(79, 124, 255, 0.18);
  border-radius: var(--radius);
  margin-bottom: 20px;
  gap: 12px;
}

.invoice-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.invoice-icon {
  color: var(--accent);
  opacity: 0.8;
  flex-shrink: 0;
}

.invoice-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.invoice-text strong {
  color: var(--text-primary);
  font-weight: 500;
}

.invoice-link {
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
  flex-shrink: 0;
}

.invoice-link:hover {
  text-decoration: underline;
}

.card-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.01);
  flex-wrap: wrap;
}

.footer-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.footer-meta strong {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Other services grid (reference) */
.other-heading {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 32px 0 12px;
}

.other-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 760px;
}

.other-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  opacity: 0.55;
  animation: fadeUp 0.4s ease both;
}

.other-card:nth-child(2) {
  animation-delay: 0.05s;
}

.other-card:nth-child(3) {
  animation-delay: 0.1s;
}

.other-card:nth-child(4) {
  animation-delay: 0.15s;
}

.other-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.other-domain {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  color: var(--text-muted);
}

.other-price {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ----- Generic cards / dashboard / tables ----- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.card-pad {
  padding: 20px 24px;
}

.grid-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  max-width: 1200px;
}

.metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.metric-value {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 300;
  letter-spacing: -0.6px;
}

.metric-sub {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

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

.table th,
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

.table th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
}

/* Pills aligned with status-pill */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulseDot 2s ease-in-out infinite;
}

.pill-accent {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(79, 124, 255, 0.2);
}

.pill-amber {
  color: var(--amber);
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.pill-green {
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.pill-red {
  color: var(--red);
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.pill-grey {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.footer-legal {
  padding: 16px 32px 24px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Legacy detail-grid (detail page) → match reference gap grid */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 14px;
}

.detail-grid .cell {
  background: var(--surface);
  padding: 14px 18px;
}

.detail-grid .sep {
  display: none;
}

.field-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.field-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.nav-sep {
  margin: 14px 10px 8px;
  height: 1px;
  background: var(--border);
}

/* Forms, login, misc */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(520px, 100%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 22px;
}

.login-brand {
  display: grid;
  place-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.input {
  width: 100%;
  height: 40px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-primary);
  padding: 0 12px;
  outline: none;
  font: inherit;
}

.textarea {
  width: 100%;
  min-height: 120px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-primary);
  padding: 10px 12px;
  outline: none;
  resize: vertical;
  font: inherit;
}

.select {
  width: 100%;
  height: 40px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-primary);
  padding: 0 10px;
  outline: none;
  font: inherit;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 13px;
}

.paper {
  background: #f6f7fb;
  color: #111827;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(17, 24, 39, 0.12);
  padding: 18px;
}

.paper h2 {
  margin: 0 0 10px;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.paper .muted {
  color: #6b7280;
  font-size: 13px;
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.row > * {
  flex: 1;
  min-width: 220px;
}

.stack {
  display: grid;
  gap: 16px;
}

.small {
  font-size: 12px;
  color: var(--text-secondary);
}

.hr {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

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

.btn-danger {
  background: rgba(248, 113, 113, 0.14);
  border: 1px solid rgba(248, 113, 113, 0.28);
  color: #fecaca;
}

.message {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 12px;
}

.message.staff {
  border-left: 3px solid var(--accent);
}

.message.internal {
  border-left: 3px solid var(--amber);
}

.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 8px;
}

.pagination {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 13px;
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.switch {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border);
  position: relative;
  background: rgba(255, 255, 255, 0.06);
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
}

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

@media (max-width: 720px) {
  .layout {
    flex-direction: column;
  }
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
  }
  .main {
    margin-left: 0;
    width: 100%;
  }
  .grid-metrics {
    grid-template-columns: 1fr;
  }
  .content {
    padding: 20px 16px;
  }
  .topbar {
    padding: 0 16px;
  }
}

/* Discount/override price styling */
.price-was {
  color: #ef4444;
  text-decoration: line-through;
  opacity: 0.85;
  font-weight: 600;
}
.price-now {
  color: #22c55e;
  font-weight: 800;
}
.price-plain {
  font-weight: 700;
}
.badge-discount {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #22c55e;
  white-space: nowrap;
}
.price-line.small .price-was,
.price-line.small .price-now,
.price-line.small .price-plain {
  font-size: 12px;
}
