:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #64748b;
  --line: #dce3ea;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --blue: #2563eb;
  --violet: #7c3aed;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: #0b1220;
  color: #e5edf6;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand,
.stat-card,
.plan-card,
.ticket-row,
.payment-row,
.customer-row,
.toolbar,
.notification-row,
.report-band,
.login-panel,
.profile-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #14b8a6;
  color: #06221f;
  font-weight: 800;
}

.brand span,
.future-note span {
  display: block;
  color: #a9b7c9;
  font-size: 13px;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.mode-btn,
.nav-btn {
  border: 0;
  border-radius: 7px;
  color: #dbe7f5;
  background: transparent;
}

.mode-btn {
  padding: 10px 8px;
}

.mode-btn.active,
.nav-btn.active {
  background: #ffffff;
  color: #0f172a;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-btn {
  width: 100%;
  text-align: left;
  padding: 11px 12px;
}

.nav-btn:not(.active):hover {
  background: rgba(255, 255, 255, 0.08);
}

.future-note {
  margin-top: auto;
  padding: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 8px;
}

.main {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 32px;
}

h2 {
  margin-bottom: 10px;
  font-size: 22px;
}

h3 {
  margin-bottom: 8px;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.top-actions,
.row-actions,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.icon-btn {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 10px 13px;
  min-height: 40px;
  font-weight: 750;
}

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

.primary-btn:hover {
  background: var(--teal-dark);
}

.secondary-btn,
.icon-btn {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.danger-btn {
  color: #fff;
  background: var(--red);
}

.login-panel {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 20px;
  align-items: end;
  padding: 20px;
  margin-bottom: 20px;
}

.login-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  min-height: 40px;
}

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

.content-grid {
  display: grid;
  gap: 18px;
}

.stats-grid,
.plans-grid,
.form-grid,
.two-col,
.three-col {
  display: grid;
  gap: 14px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.two-col {
  grid-template-columns: 1.25fr 0.75fr;
}

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

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

.stat-card,
.plan-card,
.toolbar,
.report-band,
.profile-card {
  padding: 18px;
}

.stat-value {
  display: block;
  margin: 7px 0;
  font-size: 28px;
  font-weight: 850;
}

.stat-label,
.meta,
.mini {
  color: var(--muted);
  font-size: 13px;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 850;
}

.status.active,
.status.resolved,
.status.paid,
.status.success,
.status.sent,
.status.converted {
  color: #166534;
  background: #dcfce7;
}

.status.expiring,
.status.expiring-soon,
.status.pending,
.status.assigned,
.status.on-the-way,
.status.working,
.status.contacted {
  color: #92400e;
  background: #fef3c7;
}

.status.expired,
.status.failed,
.status.suspended,
.status.rejected,
.status.closed {
  color: #991b1b;
  background: #fee2e2;
}

.status.new {
  color: #1d4ed8;
  background: #dbeafe;
}

.speed {
  font-size: 34px;
  font-weight: 900;
}

.rupee {
  color: var(--teal-dark);
  font-weight: 900;
}

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

.ticket-row,
.payment-row,
.customer-row,
.notification-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.customer-row {
  grid-template-columns: 1.3fr 0.9fr 0.8fr auto;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.compact-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.error-box,
.warning-banner {
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 750;
}

.error-box {
  margin-bottom: 12px;
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fecaca;
}

.warning-banner {
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
}

.warning-banner.danger {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fecaca;
}

.empty-state {
  box-shadow: none;
}

.unread {
  border-color: #14b8a6;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 7px;
  min-height: 40px;
  padding: 10px 13px;
  font-weight: 750;
}

.hidden {
  display: none !important;
}

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.admin-table th {
  color: #475569;
  background: #f8fafc;
}

#appDialog {
  width: min(720px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
}

#appDialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
}

.dialog-card {
  position: relative;
  padding: 22px;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  width: 32px;
  height: 32px;
}

.receipt {
  border: 1px solid var(--line);
  padding: 18px;
  border-radius: 8px;
}

@media print {
  body * {
    visibility: hidden;
  }

  #appDialog,
  #appDialog * {
    visibility: visible;
  }

  #appDialog {
    position: absolute;
    inset: 0;
    width: 100%;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .mode-switch {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .plans-grid,
  .two-col,
  .three-col,
  .login-panel,
  .login-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .main {
    padding: 18px;
  }

  .topbar,
  .toolbar,
  .ticket-row,
  .payment-row,
  .customer-row,
  .notification-row {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

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

  h1 {
    font-size: 26px;
  }
}
