:root {
    color-scheme: dark;

    --bg: #020c18;
    --bg-top: #071727;
    --surface: #0d1b2b;
    --surface-2: #142438;
    --surface-3: rgba(255, 255, 255, 0.065);
    --line: rgba(255, 255, 255, 0.10);

    --text: #f7f9fc;
    --muted: #9aa9bc;
    --muted-2: #718197;

    --blue: #1683ff;
    --blue-2: #0568e8;
    --blue-soft: rgba(22, 131, 255, 0.16);

    --green: #2bd576;
    --green-soft: rgba(43, 213, 118, 0.14);

    --red: #ff5364;
    --red-soft: rgba(255, 83, 100, 0.14);

    --orange: #ffad32;
    --orange-soft: rgba(255, 173, 50, 0.14);

    --side: 14px;
    --top-space: 48px;
    --bottom-space: 18px;
    --nav-height: 64px;
}

* {
    box-sizing: border-box;
    min-width: 0;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;

    background:
        radial-gradient(circle at 45% -8%, rgba(22, 131, 255, 0.16), transparent 34%),
        linear-gradient(180deg, var(--bg-top), var(--bg));

    color: var(--text);
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "SF Pro Display",
        "SF Pro Text",
        Inter,
        system-ui,
        sans-serif;

    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

img {
    display: block;
    max-width: 100%;
}

.hidden {
    display: none !important;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.screen {
    position: absolute;
    inset: 0;

    display: flex;
    flex-direction: column;

    width: 100%;
    height: 100%;
    padding:
        var(--top-space)
        var(--side)
        calc(var(--bottom-space) + var(--nav-height));

    overflow: hidden;
}

/* Loading */

.loading-view {
    position: absolute;
    inset: 0;

    display: grid;
    place-content: center;
    justify-items: center;
    gap: 10px;

    padding: 20px;
    text-align: center;

    background:
        radial-gradient(circle at 50% 20%, rgba(22, 131, 255, 0.15), transparent 30%),
        var(--bg);
}

.app-icon {
    width: 58px;
    height: 58px;

    display: grid;
    place-items: center;

    border-radius: 17px;
    background: linear-gradient(145deg, #3496ff, #0758ca);
    box-shadow: 0 18px 36px rgba(22, 131, 255, 0.28);

    color: white;
    font-size: 22px;
    font-weight: 900;
}

.loading-view strong {
    font-size: 16px;
}

.loading-view span {
    max-width: 260px;

    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.spinner {
    width: 28px;
    height: 28px;

    border: 3px solid var(--line);
    border-top-color: var(--blue);
    border-radius: 50%;

    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.boot-visible {
    display: grid !important;
}

/* Main header */

.ios-header {
    flex: 0 0 auto;

    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;

    padding: 2px 2px 18px;
}

.header-kicker {
    margin: 0 0 5px;

    color: var(--blue);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.16em;
}

.ios-header h1 {
    margin: 0;

    font-size: 31px;
    line-height: 0.98;
    letter-spacing: -0.045em;
}

.header-status {
    flex: 0 0 auto;

    min-width: 72px;
    display: grid;
    justify-items: center;
    gap: 3px;

    padding: 9px 11px;
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 12px;

    background: rgba(14, 29, 47, 0.82);
    color: var(--muted);

    font-size: 12px;
    line-height: 1.15;
}

.status-top {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    color: var(--text);
}

.status-top strong {
    font-size: 12px;
    letter-spacing: 0.035em;
}

.live-dot {
    width: 9px;
    height: 9px;

    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 12px rgba(43, 213, 118, 0.62);
}

/* Search */

.ios-search {
    flex: 0 0 auto;

    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;

    min-height: 52px;
    padding: 5px;

    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 13px;

    background: linear-gradient(180deg, rgba(31, 47, 67, 0.96), rgba(22, 37, 56, 0.96));
    overflow: hidden;
}

.ios-search > span {
    padding-left: 9px;

    color: var(--muted);
    font-size: 22px;
}

.ios-search input {
    width: 100%;
    min-width: 0;

    border: 0;
    outline: 0;

    padding: 12px 0;

    background: transparent;
    color: var(--text);

    font-size: 14px;
}

.ios-search input::placeholder {
    color: #8d9aad;
    opacity: 1;
}

.ios-search button {
    min-width: 58px;

    border: 0;
    border-radius: 10px;

    padding: 12px 13px;

    background: linear-gradient(180deg, #2996ff, var(--blue-2));
    color: white;

    font-size: 14px;
    font-weight: 850;
}

/* Tabs */

.segmented-control {
    flex: 0 0 auto;

    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;

    margin-top: 12px;
    padding: 4px;

    border: 1px solid rgba(255, 255, 255, 0.045);
    border-radius: 12px;

    background: rgba(24, 40, 60, 0.94);
}

.filter {
    border: 0;
    border-radius: 9px;

    padding: 11px 4px;

    background: transparent;
    color: #c2cad5;

    font-size: 14px;
    font-weight: 750;
}

.filter.active {
    background: linear-gradient(180deg, #2d8eff, #146cdd);
    color: white;
    box-shadow: 0 5px 14px rgba(4, 94, 208, 0.28);
}

/* Search summary */

.summary-row {
    flex: 0 0 auto;

    min-height: 45px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;

    padding: 14px 2px 8px;

    border-bottom: 1px solid rgba(255, 255, 255, 0.075);

    color: #c6ced9;
    font-size: 14px;
}

.clear-button {
    border: 0;
    background: transparent;
    color: var(--blue);

    font-size: 14px;
    font-weight: 750;
}

/* Scroll containers */

.results,
.detail-scroll,
.record-scroll {
    min-height: 0;
    width: 100%;

    overflow-y: auto;
    overflow-x: hidden;

    scrollbar-width: none;
}

.results {
    flex: 1 1 auto;
    padding: 12px 0 18px;
}

.detail-scroll,
.record-scroll {
    flex: 1 1 auto;
    padding-bottom: 16px;
}

.results::-webkit-scrollbar,
.detail-scroll::-webkit-scrollbar,
.record-scroll::-webkit-scrollbar {
    display: none;
}

/* Empty search */

.empty-search {
    min-height: 330px;

    display: grid;
    align-content: center;
    justify-items: center;
    gap: 12px;

    padding: 32px 22px;
    text-align: center;
}

.empty-search-icon {
    width: 82px;
    height: 82px;

    display: grid;
    place-items: center;

    border-radius: 50%;

    background: radial-gradient(circle at 38% 30%, #174b91, #07172c 72%);
    color: var(--blue);

    font-size: 54px;
    line-height: 1;
}

.empty-search strong {
    font-size: 19px;
    letter-spacing: -0.02em;
}

.empty-search p {
    max-width: 280px;
    margin: 0;

    color: var(--muted);
    font-size: 15px;
    line-height: 1.45;
}

/* Section labels */

.section-label {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin: 2px 2px 9px;

    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.section-label b {
    min-width: 24px;

    padding: 3px 8px;
    border-radius: 999px;

    background: var(--surface-3);
    color: var(--text);

    text-align: center;
    font-size: 12px;
}

/* Shared cards */

.result-card,
.profile-card,
.category-card,
.detail-card {
    width: 100%;
    max-width: 100%;

    border: 1px solid var(--line);
    border-radius: 14px;

    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    overflow: hidden;
}

/* Result cards */

.result-card {
    margin-bottom: 10px;
    padding: 12px;
}

.result-card > button {
    all: unset;

    display: block;
    width: 100%;

    cursor: pointer;
}

.result-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.identity {
    flex: 1 1 auto;

    display: flex;
    align-items: center;
    gap: 11px;

    min-width: 0;
}

.avatar-small {
    width: 52px;
    height: 52px;
    flex: 0 0 auto;

    display: grid;
    place-items: center;

    border-radius: 12px;
    object-fit: cover;

    background: linear-gradient(145deg, #1e579f, #102f65);
    color: #dceaff;

    font-size: 16px;
    font-weight: 850;
}

.avatar-small.vehicle {
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.07);
    color: white;
    font-size: 21px;
}

.identity h3 {
    margin: 0 0 4px;

    font-size: 17px;
    line-height: 1.15;

    overflow-wrap: anywhere;
}

.meta {
    margin: 0;

    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;

    overflow-wrap: anywhere;
    word-break: break-word;
}

.badge-stack {
    flex: 0 0 auto;
    max-width: 36%;

    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.badge {
    display: inline-flex;
    max-width: 100%;

    padding: 4px 7px;
    border-radius: 6px;

    font-size: 10px;
    font-weight: 900;

    white-space: normal;
    text-align: right;
    overflow-wrap: anywhere;
}

.badge.blue {
    background: var(--blue-soft);
    color: #7cb9ff;
}

.badge.green {
    background: var(--green-soft);
    color: #73e89e;
}

.badge.red {
    background: var(--red-soft);
    color: #ff939e;
}

.badge.orange {
    background: var(--orange-soft);
    color: #ffc56d;
}

.chevron {
    color: #8292a7;
    font-size: 24px;
}

/* Statistics */

.person-stats,
.stats-grid {
    width: 100%;

    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
}

.person-stats {
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid var(--line);
}

.person-stat,
.stat-card {
    min-width: 0;
    text-align: center;
}

.person-stat strong,
.stat-card strong {
    display: block;
    font-size: 17px;
}

.person-stat span,
.stat-card span {
    display: block;

    margin-top: 3px;

    color: var(--muted);
    font-size: 10px;
    line-height: 1.2;

    overflow-wrap: anywhere;
}

/* Bottom navigation */

.tab-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: var(--bottom-space);

    height: var(--nav-height);

    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));

    border-top: 1px solid rgba(255, 255, 255, 0.09);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);

    background: rgba(3, 12, 22, 0.96);
    backdrop-filter: blur(20px);

    z-index: 20;
}

.tab-item {
    min-width: 0;

    border: 0;
    background: transparent;
    color: #929eae;

    display: grid;
    place-content: center;
    gap: 3px;

    text-align: center;
}

.tab-item span {
    font-size: 23px;
    line-height: 1;
}

.tab-item b {
    font-size: 11px;
    font-weight: 650;
}

.tab-item.active {
    color: var(--blue);
}

.tab-item.active::after {
    content: "";

    width: 34px;
    height: 3px;

    margin: 2px auto 0;
    border-radius: 999px;

    background: var(--blue);
}

/* Detail page */

.detail-screen {
    padding-bottom: var(--bottom-space);
}

.detail-header {
    flex: 0 0 auto;

    width: 100%;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    gap: 4px;

    padding-bottom: 12px;
}

.back,
.star {
    width: 42px;
    height: 42px;

    border: 0;
    background: transparent;

    color: var(--blue);
    font-size: 30px;
}

.star {
    color: #ffd52f;
    font-size: 23px;
}

.detail-title {
    min-width: 0;
    text-align: center;
}

.detail-title span {
    display: block;

    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.07em;
}

.detail-title h2 {
    margin: 3px 0 0;

    font-size: 20px;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.detail-title p {
    margin: 3px 0 0;

    color: var(--muted);
    font-size: 12px;
}

.profile-card {
    padding: 14px;
    margin-bottom: 10px;
}

.profile-main {
    display: flex;
    align-items: center;
    gap: 13px;
}

.avatar-large {
    width: 78px;
    height: 78px;
    flex: 0 0 auto;

    display: grid;
    place-items: center;

    border-radius: 15px;
    object-fit: cover;

    background: linear-gradient(145deg, #1e579f, #102f65);
    color: white;

    font-size: 22px;
    font-weight: 850;
}

.profile-main > div:last-child {
    flex: 1 1 auto;
    min-width: 0;
}

.profile-main h3 {
    margin: 0 0 4px;

    font-size: 21px;
    overflow-wrap: anywhere;
}

.profile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;

    margin-bottom: 7px;
}

.stats-grid {
    margin-bottom: 10px;
}

.stat-card {
    padding: 10px 3px;

    border: 1px solid var(--line);
    border-radius: 11px;

    background: rgba(255, 255, 255, 0.045);
}

/* Categories */

.category-grid {
    width: 100%;

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;

    margin-bottom: 10px;
}

.category-button {
    min-width: 0;

    border: 1px solid var(--line);
    border-radius: 12px;

    padding: 12px;

    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    color: var(--text);

    text-align: left;
}

.category-button.active {
    border-color: rgba(22, 131, 255, 0.65);
    box-shadow: inset 0 0 0 1px rgba(22, 131, 255, 0.16);
}

.category-button span {
    display: block;

    margin-bottom: 5px;

    color: var(--blue);
    font-size: 20px;
}

.category-button strong {
    display: block;
    font-size: 14px;
}

.category-button small {
    display: block;

    margin-top: 3px;

    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
}

.category-panel {
    display: none;
}

.category-panel.active {
    display: block;
}

.category-card {
    padding: 13px;
    margin-bottom: 10px;
}

.card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;

    margin-bottom: 10px;
}

.card-title h3 {
    margin: 0;
    font-size: 16px;
}

.card-title span {
    color: var(--muted);
    font-size: 12px;
}

/* Information grid */

.info-grid {
    width: 100%;

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
}

.info {
    min-width: 0;

    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.info label {
    display: block;

    margin-bottom: 3px;

    color: var(--muted);
    font-size: 11px;
}

.info strong {
    display: block;

    font-size: 13px;

    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Lists */

.list {
    width: 100%;
    display: grid;
}

.list-button {
    all: unset;

    width: 100%;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;

    padding: 11px 0;
    border-top: 1px solid var(--line);

    cursor: pointer;
}

.list-button:first-child {
    border-top: 0;
    padding-top: 0;
}

.list-button:last-child {
    padding-bottom: 0;
}

.list-button > div {
    flex: 1 1 auto;
    min-width: 0;
}

.list-button strong {
    display: block;

    font-size: 14px;

    overflow-wrap: anywhere;
    word-break: break-word;
}

.list-button p {
    margin: 4px 0 0;

    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;

    overflow-wrap: anywhere;
    word-break: break-word;
}

.empty {
    padding: 16px 0;

    color: var(--muted);
    text-align: center;
    font-size: 13px;
}

/* Open record */

.record-view {
    width: 100%;
    height: 100%;

    display: flex;
    flex-direction: column;
}

.detail-card {
    padding: 14px;
    margin-bottom: 10px;
}

.detail-card h3 {
    margin: 0 0 9px;
    font-size: 17px;
}

.detail-card h4 {
    margin: 13px 0 6px;
    font-size: 14px;
}

.detail-card p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;

    overflow-wrap: anywhere;
    word-break: break-word;
}

.field-row {
    width: 100%;

    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 10px;

    padding: 9px 0;
    border-top: 1px solid var(--line);
}

.field-row:first-child {
    border-top: 0;
}

.field-row span {
    color: var(--muted);
    font-size: 12px;
}

.field-row strong {
    min-width: 0;

    text-align: right;
    font-size: 13px;

    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Small LB Phone viewport */

@media (max-width: 350px) {
    :root {
        --side: 11px;
        --top-space: 44px;
        --nav-height: 60px;
    }

    html,
    body {
        font-size: 15px;
    }

    .ios-header h1 {
        font-size: 27px;
    }

    .header-status {
        min-width: 66px;
        padding: 8px 9px;
    }

    .ios-search input {
        font-size: 13px;
    }

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

    .avatar-large {
        width: 69px;
        height: 69px;
    }
}

@media (max-width: 305px) {
    .header-status {
        display: none;
    }

    .ios-search {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .ios-search button {
        grid-column: 1 / -1;
        width: 100%;
    }

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