:root {
    color-scheme: dark;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #0c1017;
    color: #e4eaf3;
    font-size: 14px;
    --muted: #9ba9bd;
    --line: #273140;
    --panel: #141b25;
    --accent: #69dfb0
}

* {
    box-sizing: border-box
}

body {
    margin: 0
}

main {
    max-width: 1550px;
    margin: auto;
    padding: 26px 30px
}

h1,
h2,
h3,
p {
    margin: 0
}

h1 {
    font-size: 21px;
    letter-spacing: -.5px
}

h2 {
    font-size: 17px
}

h3 {
    font-size: 14px
}

p {
    line-height: 1.6
}

.topbar,
.brand,
.panel-header,
.reader-heading,
.actions,
.page-footer {
    display: flex;
    align-items: center;
    gap: 14px
}

.topbar,
.panel-header,
.page-footer {
    justify-content: space-between
}

.brand-icon {
    display: grid;
    place-items: center;
    background: #183e35;
    color: var(--accent);
    width: 44px;
    height: 44px;
    border: 1px solid #2d6956;
    border-radius: 12px;
    font-size: 26px
}

.brand p,
.panel-header p,
.muted,
small {
    color: var(--muted)
}

.brand p {
    font-size: 12px;
    margin-top: 3px
}

.badge {
    display: inline-block;
    color: #b4bfce;
    background: #202a37;
    border: 1px solid #344153;
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 11px
}

.notice {
    margin: 23px 0 18px;
    padding: 10px 14px;
    border: 1px solid #314258;
    border-radius: 8px;
    background: #172131;
    color: #b8cbe1;
    font-size: 12px
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px
}

.metrics article {
    padding: 16px 19px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--panel)
}

.metrics span,
.metrics small {
    display: block
}

.metrics span {
    color: #b9c5d5;
    font-size: 12px
}

.metrics strong {
    display: block;
    font-size: 28px;
    margin: 6px 0
}

.metrics small {
    font-size: 11px
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 18px;
    align-items: start
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden
}

.panel-header {
    padding: 19px;
    border-bottom: 1px solid var(--line)
}

.panel-header p {
    font-size: 11px;
    margin-top: 5px
}

button,
input,
select {
    font: inherit;
    border-radius: 7px;
    border: 1px solid #3b4b60;
    background: #202c3b;
    color: #dae4f1;
    padding: 9px 12px
}

button {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap
}

button.primary {
    background: #214d40;
    color: #b5f2d9;
    border-color: #36745e
}

button:disabled,
input:disabled,
select:disabled {
    cursor: not-allowed;
    opacity: .65
}

button.danger {
    background: #40272c;
    border-color: #704047;
    color: #f7c5c8
}

.filters {
    padding: 15px 19px;
    display: flex;
    gap: 10px;
    align-items: center
}

.filters label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%)
}

input {
    min-width: 0;
    flex: 1;
    background: #0f1620
}

select {
    font-size: 12px;
    background: #18212d
}

.table-scroll {
    overflow-x: auto
}

table {
    border-collapse: collapse;
    width: 100%;
    text-align: left
}

th {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .7px;
    color: #9aabc1;
    font-weight: 600;
    padding: 12px 15px;
    border-block: 1px solid var(--line);
    background: #111923;
    white-space: nowrap
}

td {
    padding: 15px
}

.empty {
    text-align: center;
    padding: 85px 10px 105px
}

.empty-icon {
    display: block;
    font-size: 36px;
    color: #6e889c;
    margin-bottom: 15px
}

.empty h3 {
    margin-bottom: 10px;
    color: #cdd8e7
}

.empty p {
    color: var(--muted);
    font-size: 12px
}

.panel-footer {
    border-top: 1px solid var(--line);
    padding: 13px 19px;
    color: var(--muted);
    font-size: 11px
}

.reader-body {
    padding: 19px
}

.reader-icon {
    font-size: 30px;
    color: var(--accent);
    background: #1a2e2e;
    border-radius: 9px;
    padding: 7px 12px
}

.reader-heading .badge {
    margin-top: 6px
}

dl {
    margin: 21px 0
}

dl div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 12px 0;
    font-size: 12px
}

dt {
    color: var(--muted)
}

dd {
    margin: 0
}

.wide {
    width: 100%
}

.divider {
    height: 1px;
    background: var(--line);
    margin: 21px 0
}

.muted {
    font-size: 12px;
    margin-top: 7px
}

.comparison {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: 16px 0
}

.comparison span {
    font-size: 10px;
    background: #101822;
    border: 1px solid var(--line);
    padding: 10px 6px;
    text-align: center;
    border-radius: 7px;
    color: var(--muted)
}

.comparison b {
    display: block;
    color: #d4dfed;
    font-size: 18px;
    margin-top: 6px
}

.actions {
    gap: 8px
}

.actions button {
    flex: 1;
    padding: 10px 8px
}

details {
    margin-top: 21px;
    border-top: 1px solid var(--line);
    padding-top: 15px
}

summary {
    font-size: 12px;
    color: #d0a4a9;
    cursor: pointer
}

details p {
    font-size: 12px;
    color: var(--muted);
    margin: 12px 0
}

.page-footer {
    font-size: 11px;
    color: #8190a5;
    margin-top: 20px
}

summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 5px
}

@media(min-width:1500px) {
    .workspace {
        grid-template-columns: minmax(0, 1fr) 390px
    }
}

@media(max-width:1050px) {
    .workspace {
        grid-template-columns: 1fr
    }

    .reader-body {
        max-width: none
    }

    .empty {
        padding: 45px 10px
    }

    .readers {
        width: 100%
    }
}

@media(max-width:600px) {
    main {
        padding: 18px 12px
    }

    .metrics {
        grid-template-columns: repeat(2, 1fr);
        gap: 9px
    }

    .topbar {
        align-items: flex-start
    }

    .topbar>.badge {
        max-width: 105px;
        text-align: center
    }

    .panel-header {
        padding: 15px
    }

    .filters {
        padding: 13px;
        flex-wrap: wrap
    }

    .filters input {
        flex-basis: 100%
    }

    .page-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px
    }

    h1 {
        font-size: 18px
    }
}

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

.form-grid label {
    display: grid;
    gap: 6px;
    color: #b9c5d5;
    font-size: 12px
}

.form-grid input,
.form-grid select {
    width: 100%;
    font-size: 14px
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px
}

.login-panel {
    max-width: 420px;
    margin: 60px auto
}

.reader-card+.reader-card {
    border-top: 1px solid var(--line)
}

.pending {
    margin-top: 18px
}

.pending .actions {
    margin-top: 16px
}

button:not(:disabled) {
    cursor: pointer
}

button:not(:disabled):hover {
    filter: brightness(1.2)
}

input:focus-visible,
select:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px
}

dd {
    overflow-wrap: anywhere;
    text-align: right
}

.topbar form {
    display: flex;
    align-items: center;
    gap: 8px
}

/* Personas como área principal; acciones junto a cada lectora. */
.metrics {
    margin-top: 20px
}

.people td {
    padding: 13px 15px;
    border-bottom: 1px solid var(--line);
    font-size: 12px
}

.people tbody tr[data-person]:hover {
    background: #192330
}

.badge-active {
    color: #a6e8c8;
    border-color: #32614e;
    background: #19382d
}

.reader-actions {
    display: grid;
    gap: 8px;
    margin-top: 14px
}

.reader-card dl {
    margin: 15px 0
}

.reader-sidebar {
    min-width: 0
}

dialog {
    padding: 0;
    width: min(480px, calc(100% - 28px));
    max-height: calc(100dvh - 40px);
    overflow: auto;
    border: 1px solid #3b4b60;
    border-radius: 12px;
    background: var(--panel);
    color: #e4eaf3;
    box-shadow: 0 24px 90px #0008
}

dialog::backdrop {
    background: #05090dcc;
    backdrop-filter: blur(3px)
}

dialog .notice {
    margin: 14px 19px 0
}

.reader-sidebar summary {
    color: #b9c5d5
}

.people .empty {
    padding: 65px 12px
}

.person-photo {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    display: block;
    border: 1px solid var(--line)
}

input[readonly] {
    color: var(--muted)
}

input[type=file] {
    padding: 8px;
    font-size: 12px
}

.reader-sidebar>.wide {
    margin-bottom: 12px
}

.sync-count {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 15px;
    padding: 12px;
    background: #101822;
    border-radius: 8px;
    color: var(--muted)
}

.sync-count strong {
    font-size: 24px;
    color: var(--accent)
}

#sync-form input[type=checkbox] {
    width: auto
}

[data-comparison] {
    margin-top: 16px;
    font-size: 12px;
    overflow-wrap: anywhere
}

[data-comparison] summary {
    cursor: pointer
}

[data-comparison] ul {
    padding-left: 18px;
    max-height: 340px;
    overflow: auto
}

[data-comparison] li {
    margin-bottom: 12px
}

[data-sync-mode] {
    font-size: 13px;
    line-height: 1.5
}

[data-sync-mode] label {
    margin-top: 12px
}

[hidden] {
    display: none !important
}

#sync-progress-dialog .progress-count {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    margin-top: 12px
}

#sync-progress-bar {
    display: block;
    width: 100%;
    height: 14px;
    accent-color: var(--accent);
    border: 0;
    border-radius: 20px;
    overflow: hidden;
    background: #202c3b
}

#sync-progress-bar::-webkit-progress-bar {
    background: #202c3b;
    border-radius: 20px
}

#sync-progress-bar::-webkit-progress-value {
    background: var(--accent);
    border-radius: 20px
}

#sync-progress-bar::-moz-progress-bar {
    background: var(--accent);
    border-radius: 20px
}

#sync-progress-dialog .notice {
    margin: 0
}

.person-sync { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin: .25rem 0; }
.person-sync > span { color: var(--muted); font-size: .85rem; }
.sync-pending { color: #ff7b86; }
.sync-updated { color: #67df9a; }
