/*
 * The customer portal's own stylesheet (app.nowa.dk/portal).
 *
 * The portal panel ships Filament's compiled CSS and nothing else: there is no
 * Tailwind build here, so a utility class in a portal view (grid, gap-3,
 * text-sm, mt-4 ...) styles nothing. That is how every page lost its spacing
 * once. Portal views therefore use ONLY the np-* classes below, next to
 * Filament's own components. tests/Feature/PortalStyleTest.php fails on any
 * other class in a portal view, and tests/Browser/run-eyes.sh looks at the
 * result in a real browser.
 *
 * Colours come from Filament's variables (--gray-*, --primary-*, --danger-*,
 * --warning-*, --success-*, --info-*), so the panel colour and dark mode follow.
 * Unlayered on purpose: it wins over Filament's @layer rules without !important.
 */

/* ---------------------------------------------------------------- base */
.np {
    --np-text: var(--gray-950);
    --np-muted: var(--gray-500);
    --np-line: var(--gray-200);
    --np-soft: var(--gray-50);
    --np-code: var(--gray-100);
    color: var(--np-text);
    font-size: 0.875rem;
    line-height: 1.5rem;
    min-width: 0;
}
.dark .np {
    --np-text: #fff;
    --np-muted: var(--gray-400);
    --np-line: rgb(255 255 255 / 0.1);
    --np-soft: rgb(255 255 255 / 0.04);
    --np-code: rgb(255 255 255 / 0.08);
}
.np p { margin: 0; }
.np strong { font-weight: 600; }
.np a:not(.fi-btn):not(.fi-link) { color: var(--primary-600); text-decoration: underline; text-underline-offset: 2px; }
.dark .np a:not(.fi-btn):not(.fi-link) { color: var(--primary-400); }

/* vertical rhythm: every direct child one step apart */
.np-stack { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
.np-stack-sm { display: grid; gap: 0.75rem; grid-template-columns: minmax(0, 1fr); }

/* columns that fold to one on a phone */
.np-cols-2, .np-cols-3 { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); align-items: stretch; }
@media (min-width: 768px) {
    .np-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .np-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.np-span-all { grid-column: 1 / -1; }
/* a Filament section that fills its grid cell, with its actions at the bottom */
.np-cols-2 > .fi-section, .np-cols-3 > .fi-section { display: flex; flex-direction: column; }
.np-cols-2 > .fi-section > .fi-section-content-ctn, .np-cols-3 > .fi-section > .fi-section-content-ctn { flex: 1; display: flex; flex-direction: column; }
.np-cols-2 > .fi-section .fi-section-content, .np-cols-3 > .fi-section .fi-section-content { flex: 1; display: flex; flex-direction: column; }
.np-card { flex: 1; display: flex; flex-direction: column; gap: 0.75rem; }
.np-card > .np-actions { margin-top: auto; padding-top: 0.25rem; }

/* ---------------------------------------------------------------- text */
.np-muted { color: var(--np-muted); }
.np-small { font-size: 0.75rem; line-height: 1.125rem; }
.np-lead { font-size: 0.9375rem; line-height: 1.6rem; }
.np-title { font-size: 1.0625rem; line-height: 1.5rem; font-weight: 600; margin: 0; }
.np-subtitle { font-size: 0.875rem; line-height: 1.25rem; font-weight: 600; margin: 0; }
.np-danger { color: var(--danger-600); }
.dark .np-danger { color: var(--danger-400); }
.np-break { overflow-wrap: anywhere; }
/* text a person typed: their line breaks kept, long words broken */
.np-text { white-space: pre-line; overflow-wrap: anywhere; }

.np code {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.8125rem;
    background: var(--np-code);
    border-radius: 0.375rem;
    padding: 0.125rem 0.375rem;
    overflow-wrap: anywhere;
}
.np-pre {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 0.75rem;
    line-height: 1.25rem;
    background: var(--gray-950);
    color: var(--gray-100);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin: 0;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.np-pre-log { max-height: 16rem; white-space: pre; overflow-wrap: normal; }
.dark .np-pre { background: rgb(0 0 0 / 0.4); }

/* lists */
.np-steps, .np-list { margin: 0; padding-left: 1.375rem; display: grid; gap: 0.375rem; }
.np-steps { list-style: decimal; }
.np-list { list-style: disc; }
.np-steps > li, .np-list > li { padding-left: 0.25rem; }
.np-steps > li::marker { color: var(--np-muted); font-weight: 600; }
.np-list > li::marker { color: var(--np-muted); }
.np-plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }

/* ---------------------------------------------------------------- rows */
.np-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; min-width: 0; }
.np-row-between { justify-content: space-between; }
.np-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.np-divider { border: 0; border-top: 1px solid var(--np-line); margin: 0; }

/* label / value pairs */
.np-dl { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.125rem 1.5rem; margin: 0; }
.np-dl > dt { color: var(--np-muted); }
.np-dl > dd { margin: 0 0 0.5rem; min-width: 0; overflow-wrap: anywhere; }
.np-dl > dd:last-child { margin-bottom: 0; }
@media (min-width: 640px) {
    .np-dl { grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr); gap: 0.5rem 1.5rem; }
    .np-dl > dd { margin: 0; }
}

/* ---------------------------------------------------------------- hero (page status header) */
.np-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.np-hero-main { display: flex; align-items: center; gap: 0.875rem; min-width: 0; flex: 1 1 16rem; }
.np-hero-icon {
    flex: none; width: 2.75rem; height: 2.75rem; border-radius: 0.75rem;
    display: grid; place-items: center;
    background: var(--primary-50); color: var(--primary-600);
    font-weight: 700; font-size: 1.125rem; letter-spacing: -0.02em;
}
.dark .np-hero-icon { background: rgb(255 255 255 / 0.06); color: var(--primary-400); }
.np-hero-icon-off { background: var(--gray-100); color: var(--gray-500); }
.np-hero-icon-warn { background: var(--warning-50); color: var(--warning-600); }

/* stat tiles */
.np-stats { display: grid; gap: 0.75rem; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
@media (min-width: 900px) { .np-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.np-stat { border: 1px solid var(--np-line); border-radius: 0.75rem; padding: 0.75rem 0.875rem; background: var(--np-soft); min-width: 0; display: grid; gap: 0.125rem; align-content: start; }
.np-stat > dt { color: var(--np-muted); font-size: 0.75rem; line-height: 1.125rem; }
.np-stat > dd { margin: 0; min-width: 0; }
.np-stat-value { font-size: 1rem; line-height: 1.5rem; font-weight: 600; overflow-wrap: anywhere; }

/* a state dot before a word */
.np-state { display: inline-flex; align-items: center; gap: 0.5rem; }
.np-dot { flex: none; width: 0.5rem; height: 0.5rem; border-radius: 999px; background: var(--gray-400); }
.np-dot-ok { background: var(--success-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success-500) 20%, transparent); }
.np-dot-warn { background: var(--warning-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning-500) 20%, transparent); }
.np-dot-bad { background: var(--danger-500); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger-500) 20%, transparent); }

/* usage meters */
.np-meter { display: grid; gap: 0.25rem; }
.np-meter-track { height: 0.375rem; border-radius: 999px; background: var(--np-line); overflow: hidden; }
.np-meter-fill { height: 100%; border-radius: 999px; background: var(--primary-500); }
.np-meter-fill-high { background: var(--warning-500); }
.np-meter-fill-full { background: var(--danger-500); }

/* ---------------------------------------------------------------- forms */
.np-form { display: grid; gap: 0.75rem; grid-template-columns: minmax(0, 1fr); }
.np-form-row { display: flex; flex-direction: column; gap: 0.75rem; }
@media (min-width: 640px) { .np-form-row { flex-direction: row; align-items: flex-end; } }
.np-field { flex: 1 1 0; min-width: 0; display: grid; gap: 0.375rem; align-content: end; }
.np-field-narrow { flex: 0 0 auto; }
@media (min-width: 640px) { .np-field-narrow { flex: 0 0 8.5rem; } }
.np-label { font-size: 0.8125rem; line-height: 1.125rem; font-weight: 500; color: var(--np-text); }
.np-hint { font-size: 0.75rem; line-height: 1.125rem; color: var(--np-muted); }
.np-form-row > .fi-btn { flex: none; }
.np-file { display: block; width: 100%; font-size: 0.8125rem; padding: 0.375rem 0; }
.np-check { display: flex; align-items: flex-start; gap: 0.625rem; }
.np-check > input { margin-top: 0.25rem; flex: none; }
/* a multi-line field inside Filament's input wrapper (the wrapper draws the border and the focus ring) */
.np-textarea {
    display: block; width: 100%; min-height: 8rem; resize: vertical; border: 0; outline: none; background: transparent;
    padding: 0.5rem 0.75rem; font: inherit; font-size: 0.875rem; line-height: 1.5rem; color: var(--np-text);
}
.np-textarea::placeholder { color: var(--np-muted); }

/* ---------------------------------------------------------------- boxes */
.np-callout { border-radius: 0.75rem; border: 1px solid var(--np-line); background: var(--np-soft); padding: 0.875rem 1rem; display: grid; gap: 0.625rem; }
.np-callout-info { border-color: var(--info-200); background: var(--info-50); }
.np-callout-warn { border-color: var(--warning-200); background: var(--warning-50); }
.np-callout-danger { border-color: var(--danger-200); background: var(--danger-50); }
.np-callout-ok { border-color: var(--success-200); background: var(--success-50); }
.dark .np-callout-info { border-color: color-mix(in srgb, var(--info-500) 40%, transparent); background: color-mix(in srgb, var(--info-500) 12%, transparent); }
.dark .np-callout-warn { border-color: color-mix(in srgb, var(--warning-500) 40%, transparent); background: color-mix(in srgb, var(--warning-500) 12%, transparent); }
.dark .np-callout-danger { border-color: color-mix(in srgb, var(--danger-500) 40%, transparent); background: color-mix(in srgb, var(--danger-500) 12%, transparent); }
.dark .np-callout-ok { border-color: color-mix(in srgb, var(--success-500) 40%, transparent); background: color-mix(in srgb, var(--success-500) 12%, transparent); }

/* a bordered item in a list (an app, a hostname, an option) */
.np-item { border: 1px solid var(--np-line); border-radius: 0.75rem; padding: 0.875rem 1rem; display: grid; gap: 0.625rem; min-width: 0; }
.np-option { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; }
.np-option > div:first-child { flex: 1 1 16rem; min-width: 0; }
.np-option + .np-option, .np-option + .np-callout, .np-callout + .np-option { margin-top: 0; }

/* the device code of a Codex login */
.np-bigcode {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
    font-size: 1.75rem; line-height: 2.25rem; font-weight: 600; letter-spacing: 0.18em;
    padding: 0.625rem 1rem; border-radius: 0.75rem;
    border: 1px dashed color-mix(in srgb, var(--primary-500) 50%, transparent);
    background: color-mix(in srgb, var(--primary-500) 6%, transparent);
    display: inline-block; user-select: all;
}

/* a line with something to copy */
.np-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; min-width: 0; }
.np-copy > code { flex: 0 1 auto; min-width: 0; }

/* ---------------------------------------------------------------- Getting started stepper */
.np-stepper { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.np-step {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.375rem 0.875rem 0.375rem 0.375rem; border-radius: 999px;
    border: 1px solid var(--np-line); background: transparent; color: var(--np-muted);
    font: inherit; font-size: 0.8125rem; line-height: 1.25rem; cursor: pointer;
}
.np-step:hover { color: var(--np-text); border-color: var(--gray-300); }
.np-step-n { width: 1.5rem; height: 1.5rem; border-radius: 999px; display: grid; place-items: center; background: var(--np-code); font-weight: 600; font-size: 0.75rem; }
.np-step-done { color: var(--np-text); }
.np-step-done .np-step-n { background: color-mix(in srgb, var(--success-500) 18%, transparent); color: var(--success-700); }
.dark .np-step-done .np-step-n { color: var(--success-400); }
.np-step-current { color: #fff; background: var(--primary-600); border-color: var(--primary-600); font-weight: 600; }
.np-step-current:hover { color: #fff; border-color: var(--primary-600); }
.np-step-current .np-step-n { background: rgb(255 255 255 / 0.22); color: #fff; }

/* help blocks: a small heading, then text */
.np-help { display: grid; gap: 1.25rem; }
.np-help > div { display: grid; gap: 0.375rem; }

/* ---------------------------------------------------------------- footer */
.np-footer { padding: 1.5rem 1rem 1.25rem; text-align: center; font-size: 0.75rem; line-height: 1.125rem; color: var(--gray-500); }
.np-footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
