:root {
    --navy: #063a58;
    --blue: #07527c;
    --aqua: #4ec8bc;
    --ink: #17313f;
    --muted: #647985;
    --surface: #f3f9f8;
    --line: #dce9e9;
    --white: #fff;
    --danger: #b3261e;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: 'Segoe UI', Inter, Arial, sans-serif;
    color: var(--ink);
    background: var(--surface);
}

a {
    color: var(--blue);
}

.guest-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 16px 45px rgba(6, 58, 88, .08);
}

.card h1 {
    font-size: 20px;
    margin: 0 0 4px;
    color: var(--navy);
}

.card p.eyebrow {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 13px;
}

/* La pantalla de licencias contiene identificadores, huellas y JSON que
   no tienen puntos naturales de corte. Sus tarjetas ocupan el ancho del
   área de trabajo y los valores siempre permanecen dentro del blanco. */
.license-page {
    min-width: 0;
}

.license-page .license-card {
    max-width: none;
    margin-bottom: 20px;
    overflow: hidden;
}

.license-page .license-kv-table {
    width: 100%;
    table-layout: fixed;
}

.license-page .license-kv-table th {
    width: min(280px, 38%);
}

.license-page td,
.license-page th,
.license-page code {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.license-table-scroll {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
}

@media (max-width: 620px) {
    .license-page .license-kv-table,
    .license-page .license-kv-table tbody,
    .license-page .license-kv-table tr,
    .license-page .license-kv-table th,
    .license-page .license-kv-table td {
        display: block;
        width: 100% !important;
    }

    .license-page .license-kv-table th {
        padding-bottom: 4px;
    }

    .license-page .license-kv-table td {
        padding-top: 4px;
    }
}

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 14px;
}

.alert {
    background: #fdecea;
    border: 1px solid #f3c2bd;
    color: var(--danger);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

button.primary {
    width: 100%;
    padding: 11px;
    border: 0;
    border-radius: 8px;
    background: var(--blue);
    color: var(--white);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

button.primary:hover {
    background: var(--navy);
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--navy);
    color: var(--white);
}

.app-topbar .brand {
    font-weight: 700;
    letter-spacing: .04em;
}

.app-topbar form button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .4);
    color: var(--white);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.app-content {
    flex: 1;
    padding: 32px 24px;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

.counters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.counter-tile {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px;
}

.counter-tile .value {
    font-size: 30px;
    font-weight: 700;
    color: var(--navy);
}

.counter-tile .label {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.counter-tile.linked {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s;
}

.counter-tile.linked:hover {
    border-color: var(--blue);
}

.app-nav {
    display: flex;
    gap: 4px;
}

.app-nav a {
    color: rgba(255, 255, 255, .75);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.app-nav a:hover {
    background: rgba(255, 255, 255, .1);
}

.app-nav a.active {
    background: rgba(255, 255, 255, .18);
    color: var(--white);
}

.alert-success {
    background: #eaf7f0;
    border: 1px solid #bfe6cf;
    color: #1a6b3d;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-head h1 {
    margin: 0 0 4px;
    color: var(--navy);
    font-size: 22px;
}

.page-head p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.toolbar input[type="text"],
.toolbar input[type="search"],
.toolbar select {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13px;
}

.toolbar label {
    font-size: 13px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--white);
}

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

.btn-danger {
    color: var(--danger);
    border-color: #f3c2bd;
}

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}

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

table.data-table th {
    background: var(--surface);
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .04em;
}

table.data-table tbody tr:last-child td {
    border-bottom: none;
}

table.data-table tbody tr.archived-row {
    opacity: .55;
}

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: var(--line);
    color: var(--ink);
}

.badge-active { background: #dcf3e6; color: #1a6b3d; }
.badge-warning { background: #fdf1dc; color: #92640c; }
.badge-danger { background: #fdecea; color: var(--danger); }
.badge-neutral { background: var(--line); color: var(--muted); }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 4px 20px;
}

.field textarea, .field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.field .error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px 24px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.detail-grid .item .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    margin-bottom: 3px;
}

.detail-grid .item .value {
    font-size: 14px;
}

.pagination-wrap {
    margin-top: 16px;
}

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--muted);
    background: var(--white);
    border: 1px dashed var(--line);
    border-radius: 10px;
}

.alert-warning {
    background: #fdf1dc;
    border: 1px solid #f2d9a3;
    color: #6b4b0c;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin: 0 0 16px;
}

.alert-warning p {
    margin: 0;
}

.help-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    align-items: start;
}

.help-sidebar {
    position: sticky;
    top: 16px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}

.help-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.help-nav a {
    display: block;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--ink);
    text-decoration: none;
}

.help-nav a:hover {
    background: var(--surface);
}

.help-nav a.help-nav-dimmed {
    color: var(--muted);
}

.help-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.help-article {
    scroll-margin-top: 16px;
    max-width: 100%;
    overflow-wrap: break-word;
}

.help-article h1 {
    margin-top: 0;
    font-size: 20px;
    color: var(--navy);
}

.help-article h2 {
    font-size: 16px;
    color: var(--navy);
    margin-top: 24px;
}

.help-article p,
.help-article li {
    font-size: 14px;
    line-height: 1.55;
}

.help-article table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
    font-size: 13px;
}

.help-article table th,
.help-article table td {
    border: 1px solid var(--line);
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
}

.help-article table th {
    background: var(--surface);
}

.help-article code {
    background: var(--surface);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 13px;
}

.help-article blockquote {
    border-left: 3px solid var(--line);
    margin: 12px 0;
    padding: 8px 14px;
    color: var(--muted);
}

.help-article blockquote.alert-warning {
    border-left: 3px solid #e2b04c;
    margin: 16px 0;
}

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

    .help-sidebar {
        position: static;
        max-height: none;
    }
}

/* Alpine (empaquetado dentro de Livewire) oculta con x-cloak los
   elementos que solo deben verse tras evaluarse su condicion — sin esta
   regla se veria un parpadeo antes de que Alpine arranque. */
[x-cloak] { display: none !important; }

/* Etiqueta visible solo para lectores de pantalla — el selector de rol
   de cada fila necesita nombre accesible sin repetir texto en pantalla. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
