@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --ink: #0f172a;
  --ink-soft: #64748b;
  --surface: #f8fafc;
  --card: #ffffff;
  --line: #e2e8f0;
}

* { box-sizing: border-box; }

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.5;
  font-size: 0.9375rem;
}

/* Tailwind preflight resets form fonts — force portal typography everywhere */
button, input, select, textarea, label {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

.text-muted { color: var(--ink-soft); }
.hint { font-size: 0.75rem; color: var(--ink-soft); }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }
.text-danger { color: #b91c1c; }
.field-label { font-size: 0.875rem; font-weight: 500; display: block; margin-bottom: 0.25rem; }

.check-label.mb-2 { margin-bottom: 0.5rem; }

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.check-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.stat-number-compact { font-size: 1.25rem; padding-top: 0.4rem; }
.stat-number-critical { color: #b71c1c; }

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.page-main {
  flex: 1;
  min-width: 0;
  max-width: 72rem;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  font-size: 0.875rem;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  padding: 0.75rem 0.75rem;
  vertical-align: top;
  text-align: left;
  overflow: hidden;
  min-width: 0;
}

.data-table thead th {
  color: var(--ink-soft);
  font-weight: 500;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.data-table .cell-muted { color: var(--ink-soft); }

.data-table td.cell-truncate,
.data-table th.cell-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
}

.data-table td .cell-truncate,
.data-table a.cell-truncate {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table .cell-num { white-space: nowrap; }
.data-table .cell-actions {
  text-align: right;
  white-space: nowrap;
  width: 5.5rem;
}

.data-table--wide {
  min-width: 64rem;
}

/* Docs — compact file tables; each section is isolated (no wide min-width). */
.docs-table-wrap {
  max-width: 100%;
}

.data-table--docs {
  table-layout: fixed;
  min-width: 0;
}

.data-table--docs .col-file { width: 52%; }
.data-table--docs .col-type { width: 12%; }
.data-table--docs .col-size { width: 14%; }
.data-table--docs .col-action { width: 22%; }

.data-table--docs th,
.data-table--docs td {
  overflow: visible;
}

.data-table--docs .docs-file-cell {
  overflow: hidden;
  min-width: 0;
}

.data-table--docs .docs-file-name {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.data-table--docs .docs-type-cell,
.data-table--docs .docs-size-cell {
  white-space: nowrap;
}

.data-table--docs .cell-actions,
.data-table--docs .docs-action-cell {
  width: auto;
  min-width: 6.5rem;
  text-align: right;
  white-space: nowrap;
  overflow: visible;
}

.data-table--docs .docs-action-cell .btn-sm {
  white-space: nowrap;
}

/* Licenses stock table */
.licenses-table-wrap {
  max-width: 100%;
}

.data-table--licenses {
  table-layout: fixed;
  min-width: 0;
}

.data-table--licenses .lic-col-package { width: 15%; }
.data-table--licenses .lic-col-qty { width: 7%; }
.data-table--licenses .lic-col-assign { width: 22%; }
.data-table--licenses .lic-col-expires { width: 11%; }
.data-table--licenses .lic-col-cost { width: 9%; }
.data-table--licenses .lic-col-note { width: 20%; }
.data-table--licenses .lic-col-action { width: 16%; }

.data-table--licenses th,
.data-table--licenses td {
  overflow: visible;
  vertical-align: middle;
}

.data-table--licenses .lic-package-cell,
.data-table--licenses .lic-note-cell,
.data-table--licenses .lic-assign-cell {
  overflow: hidden;
  min-width: 0;
}

.data-table--licenses .lic-cell-ellipsis {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table--licenses .lic-assign-cell .badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: top;
}

.data-table--licenses .lic-action-cell,
.data-table--licenses .lic-action-head {
  width: auto;
  min-width: 5.75rem;
  text-align: right;
  white-space: nowrap;
  overflow: visible;
}

.data-table--licenses .lic-action-cell .btn-ghost {
  white-space: nowrap;
}

.data-table--customers {
  table-layout: fixed;
  width: 100%;
}

.data-table--customers th,
.data-table--customers td {
  padding: 0.625rem 0.5rem;
  font-size: 0.8125rem;
  overflow: visible;
  vertical-align: middle;
}

.data-table--customers .cell-center {
  text-align: center;
}

.data-table--customers .cust-col-name { width: 14%; }
.data-table--customers .cust-col-deploy { width: 7rem; }
.data-table--customers .cust-col-email { width: 18%; }
.data-table--customers .cust-col-license { width: 18%; }
.data-table--customers .cust-col-expires { width: 12%; }
.data-table--customers .cust-col-poc { width: 7%; }
.data-table--customers .cust-col-status { width: 11%; }
.data-table--customers .cust-col-action { width: 6rem; }

.data-table--customers .cust-name-cell,
.data-table--customers .cust-email-cell,
.data-table--customers .cust-license-cell,
.data-table--customers .cust-deploy-cell {
  overflow: hidden;
  min-width: 0;
}

.data-table--customers .cust-deploy-cell {
  white-space: nowrap;
  text-align: center;
}

.data-table--customers .cust-deploy-cell .badge {
  max-width: none;
}

.data-table--customers .cust-ellipsis,
.data-table--customers a.cust-ellipsis {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table--customers .cust-action-cell,
.data-table--customers .cust-action-head {
  width: auto;
  min-width: 4.5rem;
  text-align: left;
  white-space: nowrap;
  overflow: visible;
}

.data-table--customers .cell-stack {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
  overflow: hidden;
}

.data-table--customers .badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: top;
}

.data-table .col-assign {
  min-width: 0;
  width: 26%;
}

.data-table .col-note {
  min-width: 0;
  width: 16%;
}

.assign-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
}

.select-inline {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.table-head { color: var(--ink-soft); }
.table-head-row { color: var(--ink-soft); background: var(--surface); }

.support-team {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 1rem;
}

.support-card-head {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin-bottom: 0.875rem;
}

.support-avatar {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 9999px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--line);
}

.support-avatar--icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 1.125rem;
}

.support-name {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.support-role {
  font-size: 0.8125rem;
  color: var(--ink-soft);
  margin-top: 0.125rem;
  line-height: 1.4;
}

.support-line {
  margin: 0.25rem 0;
}

.support-phone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.support-phone-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.support-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
  transition: background 0.15s ease;
}

.support-action:hover {
  background: #e0e7ff;
}

.support-action--wa {
  color: #128c7e;
  background: #e8f8f2;
}

.support-action--wa:hover {
  background: #d1f0e4;
}

.credential-code {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.asset-list-toolbar {
  margin-top: 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar {
  background: var(--card);
  border-right: 1px solid var(--line);
}

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

.sidebar-user {
  display: block;
  padding: 0.625rem 0.5rem;
  margin: 0 -0.5rem;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.sidebar-user:hover {
  background: var(--accent-soft);
}

.sidebar-user.active {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-user-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.35;
}

.sidebar-user-partner {
  display: block;
  margin-top: 0.125rem;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.sidebar-logout {
  display: inline-block;
  margin-top: 0.5rem;
  padding-left: 0.5rem;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  text-decoration: none;
  color: inherit;
}

.brand-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}

.brand-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.brand-logo {
  display: block;
  height: 22px;
  width: auto;
  max-width: 5.5rem;
  flex-shrink: 0;
  object-fit: contain;
  filter: brightness(0) saturate(100%);
}

.brand-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem 0.2rem;
  border-radius: 4px;
  background: #0f172a;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: capitalize;
  line-height: 1.2;
  flex-shrink: 0;
}

.brand-type-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.brand-type-badge--reseller {
  background: #e0e7ff;
  color: #3730a3;
}

.brand-type-badge--mssp {
  background: #dcfce7;
  color: #166534;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.875rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-soft);
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: var(--accent-soft); color: var(--accent); }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item.soon { opacity: 0.45; cursor: default; }
.nav-item--tip { cursor: help; }
.nav-item--tip:hover { opacity: 0.65; }

.card {
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-ghost:hover { background: var(--accent-soft); }
.btn-ghost.text-danger { color: #b91c1c; }
.btn-ghost.text-danger:hover { background: #fee2e2; }

.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  background: var(--card);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* list-row — not "table-row" (Tailwind CDN sets display:table-row and breaks div hover width) */
.list-row {
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: #f1f5f9; }

.card div.list-row {
  display: block;
  width: 100%;
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.stat-number { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.stat-label { font-size: 0.8125rem; color: var(--ink-soft); margin-top: 0.125rem; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-gray { background: #f1f5f9; color: var(--ink-soft); }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-amber { background: #fef3c7; color: #92400e; }

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.875em;
  background: #f1f5f9;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
}

.alert-banner {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  color: #92400e;
}
.alert-link { color: #92400e; }

.profile-grid {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.5rem 1rem;
}
.profile-grid dd { margin: 0; }

.doc-status-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.doc-status-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}
.doc-status-list li:last-child { border-bottom: none; }


.btn-danger {
  background: #dc2626;
  color: #fff;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-danger:hover { background: #b91c1c; }

.emergency-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 0.875rem 1.25rem;
  color: #991b1b;
  margin-bottom: 1rem;
}

/* Collapsible portal sections (customer detail, etc.) */
.portal-section {
  padding: 0;
  overflow: hidden;
}

.portal-section__summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.12s ease;
}

.portal-section__summary:focus {
  outline: none;
}

.portal-section__summary:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(79, 70, 229, 0.35);
  border-radius: 8px 8px 0 0;
}

.portal-section__summary::-webkit-details-marker,
.portal-section__summary::marker {
  display: none;
  content: "";
}

.portal-section__summary:hover {
  background: #f8fafc;
}

.portal-section__title {
  flex: 1;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ink);
}

.portal-section__actions {
  flex-shrink: 0;
}

.portal-section__chevron {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  color: var(--ink-soft);
  transition: transform 0.2s ease;
}

.portal-section[open] .portal-section__chevron {
  transform: rotate(180deg);
}

.portal-section[open] > .portal-section__summary {
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.portal-section__body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.portal-section__body > :first-child {
  margin-top: 0;
}

.portal-section:not([open]) .portal-section__body {
  display: none;
}
