@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Manrope:wght@600;700;800&display=swap');

:root {
    --atmr-base-neutral: #585d69;
    --atmr-base-accent: #ff4f12;
    --atmr-base-success: #00ac43;
    --atmr-base-warning: #fda610;
    --atmr-base-error: #ff2626;
    --atmr-base-info: #1f69ff;
    --atmr-base-status-01: #7700ff;
    --atmr-base-status-02: #4055e8;
    --atmr-base-status-03: #038fde;
    --atmr-base-status-04: #1898a9;
    --atmr-base-status-05: #ca20d9;
    --atmr-base-status-06: #d9206f;
    --bg: #eef2f8;
    --bg-accent: #dce5f2;
    --surface: #f9f9fa;
    --surface-strong: #f9f9fa;
    --surface-muted: #eff3f8;
    --line: rgba(88, 93, 105, 0.16);
    --text: #1f2530;
    --text-soft: #585d69;
    --brand: var(--atmr-base-accent);
    --brand-deep: #d93e08;
    --brand-soft: rgba(255, 79, 18, 0.12);
    --success: var(--atmr-base-success);
    --success-soft: rgba(0, 172, 67, 0.12);
    --warning: var(--atmr-base-warning);
    --warning-soft: rgba(253, 166, 16, 0.14);
    --error: var(--atmr-base-error);
    --error-soft: rgba(255, 38, 38, 0.12);
    --info: var(--atmr-base-info);
    --info-soft: rgba(31, 105, 255, 0.14);
    --status-01: var(--atmr-base-status-01);
    --status-02: var(--atmr-base-status-02);
    --status-03: var(--atmr-base-status-03);
    --status-04: var(--atmr-base-status-04);
    --status-05: var(--atmr-base-status-05);
    --status-06: var(--atmr-base-status-06);
    --shadow-lg: 0 2px 10px rgba(88, 93, 105, 0.06);
    --shadow-md: 0 1px 4px rgba(88, 93, 105, 0.04);
    --radius-xl: 28px;
    --radius-lg: 22px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --radius-button: 5px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background: #edf2f8;
}

body {
    font-family: 'IBM Plex Sans', sans-serif;
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(119, 0, 255, 0.03), transparent 30%);
}

body.dark-theme {
    --bg: #0f1522;
    --bg-accent: #162238;
    --surface: #131c2d;
    --surface-strong: #182234;
    --surface-muted: #202c42;
    --line: rgba(213, 222, 236, 0.12);
    --text: #f4f8ff;
    --text-soft: #a3b2c9;
    --brand: #ff6a36;
    --brand-deep: #ff4f12;
    --brand-soft: rgba(255, 79, 18, 0.18);
    --success: #20c765;
    --success-soft: rgba(32, 199, 101, 0.16);
    --warning: #ffb931;
    --warning-soft: rgba(255, 185, 49, 0.18);
    --error-soft: rgba(255, 38, 38, 0.18);
    --info-soft: rgba(31, 105, 255, 0.2);
    --shadow-lg: 0 2px 10px rgba(0, 0, 0, 0.16);
    --shadow-md: 0 1px 4px rgba(0, 0, 0, 0.12);
    background: #0f1522;
}

.phone-frame {
    max-width: 440px;
    width: 100%;
    min-height: 100vh;
    margin: 0 auto;
    background: var(--surface);
    box-shadow: none;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    border-left: 1px solid rgba(255, 255, 255, 0.18);
    border-right: 1px solid rgba(255, 255, 255, 0.18);
}

.dark-theme .phone-frame {
    background: var(--surface);
    border-left-color: rgba(255, 255, 255, 0.06);
    border-right-color: rgba(255, 255, 255, 0.06);
}

.phone-frame::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 160px;
    background: none;
    pointer-events: none;
}

.header {
    width: 100%;
    min-height: 72px;
    background: transparent;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px 14px;
    position: relative;
    z-index: 2;
}

.dark-theme .header {
    background: transparent;
}

.logo-container {
    display: flex;
    align-items: center;
    width: 154px;
    height: 44px;
}

.logo-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: saturate(1.05) contrast(1.05);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-right form {
    display: flex;
}

.header-search-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    padding: 10px 14px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    color: var(--text);
    border-radius: var(--radius-button);
    box-shadow: none;
}

.header-search-btn:hover,
.header-search-btn:active {
    transform: translateY(-1px);
    border-color: rgba(255, 79, 18, 0.28);
    background: #ffffff;
}

.header-search-btn img {
    width: 14px;
    height: 14px;
}

.search-text-header {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.main-tabs {
    margin: 0 16px;
    display: flex;
    width: calc(100% - 32px);
    background: var(--surface-muted);
    flex-shrink: 0;
    padding: 6px;
    gap: 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: none;
    overflow: hidden;
    position: relative;
    z-index: 2;
}

.dark-theme .main-tabs {
    background: var(--surface-muted);
}

.tab-button {
    min-height: 42px;
    min-width: 0;
    background-color: transparent;
    border: none;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--text-soft);
    cursor: pointer;
    transition: all 0.22s ease;
    -webkit-tap-highlight-color: transparent;
    padding: 0 14px;
    white-space: nowrap;
    font-family: 'IBM Plex Sans', sans-serif;
    flex: 1 1 0;
}

.tab-button.active {
    background: var(--status-01);
    color: #ffffff;
    box-shadow: none;
}

.tab-button:not(.active):hover {
    background: rgba(119, 0, 255, 0.08);
    color: var(--text);
}

.dark-theme .tab-button:not(.active):hover {
    background: rgba(255, 255, 255, 0.06);
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px 28px;
    position: relative;
    z-index: 1;
    background: #f4f4f5;
}

.content::-webkit-scrollbar {
    width: 8px;
}

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

.auth-card {
    width: min(100%, 420px);
    background-color: #f4f4f5;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: none;
    padding: 28px;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
}

.auth-brand img {
    width: 180px;
    max-width: 100%;
    object-fit: contain;
}

.auth-subtitle {
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.5;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
}

.auth-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
}

.auth-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-soft);
}

.auth-input {
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 0 14px;
    font: inherit;
    color: var(--text);
    background: var(--surface-strong);
}

.auth-input:focus {
    outline: none;
    border-color: rgba(255, 79, 18, 0.4);
    box-shadow: 0 0 0 4px rgba(255, 79, 18, 0.08);
}

.auth-submit,
.header-logout-btn {
    min-height: 46px;
    border: none;
    border-radius: var(--radius-button);
    background: var(--brand);
    color: #fff7f2;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    padding: 0 18px;
    box-shadow: none;
}

.header-logout-btn {
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
}

.auth-submit {
    margin-top: 10px;
}

.header-user {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-soft);
}

.header-profile-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-strong);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-soft);
    text-decoration: none;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.header-profile-link:hover,
.header-profile-link:focus {
    border-color: rgba(255, 79, 18, 0.28);
    background: #ffffff;
    color: var(--brand);
}

.header-profile-icon {
    position: relative;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border: 2px solid currentColor;
    border-radius: 999px;
}

.header-profile-icon::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 50%;
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: currentColor;
    transform: translateX(-50%);
}

.header-profile-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 2px;
    width: 8px;
    height: 4px;
    border: 2px solid currentColor;
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    transform: translateX(-50%);
}

.flash-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.flash-message {
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.4;
}

.flash-message.danger {
    background: var(--error-soft);
    color: var(--brand-deep);
    border: 1px solid rgba(255, 38, 38, 0.18);
}

.flash-message.success {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid rgba(0, 172, 67, 0.18);
}

.content::-webkit-scrollbar-thumb {
    background: rgba(88, 93, 105, 0.24);
    border-radius: 999px;
}

.inner-tabs-container {
    min-height: 46px;
    border-radius: 999px;
    display: flex;
    width: 100%;
    background-color: var(--surface-muted);
    padding: 4px;
    gap: 6px;
    margin-top: 4px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
}

.inner-tab-button {
    flex: 1;
    min-height: 36px;
    background-color: transparent;
    border: none;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.inner-tab-button.active {
    background-color: var(--status-01);
    font-weight: 700;
    color: #fff7f2;
}

.cards-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
}

.card,
.result-card {
    background: var(--surface-strong);
    border-radius: var(--radius-lg);
    padding: 18px;
    transition: border-color 0.22s ease, background 0.22s ease;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    border: 1px solid var(--line);
    box-shadow: none;
}

.dark-theme .card,
.dark-theme .result-card {
    background: var(--surface-strong);
}

.card:hover,
.result-card:hover {
    transform: none;
}

.card[data-status="open"],
.result-card[data-status="open"] {
    border-color: rgba(253, 166, 16, 0.28);
    box-shadow: none;
}

.card[data-status="closed"],
.result-card[data-status="closed"] {
    border-color: rgba(0, 172, 67, 0.24);
    box-shadow: none;
}

.card-header,
.result-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.card-title,
.result-card-title,
.section-title {
    font-family: 'Manrope', sans-serif;
}

.card-title,
.result-card-title {
    font-size: 20px;
    line-height: 1.1;
    font-weight: 800;
    color: var(--text);
    margin: 0;
}

.profile-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-date {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0 0;
    margin-top: -2px;
    font-size: 13px;
    color: var(--text-soft);
    border-top: 1px dashed rgba(88, 93, 105, 0.25);
}

.card-characteristics,
.result-card-chars {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--surface-muted);
    border-radius: var(--radius-md);
}

.characteristic-item,
.result-card-char-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.characteristic-label,
.result-card-char-name {
    color: var(--text-soft);
    font-weight: 600;
}

.characteristic-value,
.result-card-char-value {
    color: var(--text);
    text-align: right;
}

.theme-switcher {
    position: fixed;
    right: max(16px, calc((100vw - 440px) / 2 + 12px));
    bottom: 18px;
    width: 54px;
    height: 54px;
    border-radius: var(--radius-button);
    display: grid;
    place-items: center;
    background: var(--status-01);
    color: #fff;
    box-shadow: none;
    cursor: pointer;
    z-index: 30;
    user-select: none;
}

.dark-theme .theme-switcher {
    background: var(--status-01);
    color: #f4f8ff;
    box-shadow: none;
}

#themeIcon {
    font-size: 21px;
}

.loading-spinner,
.error-message,
.empty-state {
    padding: 22px 18px;
    border-radius: var(--radius-md);
    background: var(--surface-strong);
    border: 1px dashed var(--line);
    color: var(--text-soft);
    text-align: center;
    box-shadow: var(--shadow-md);
}

@media (max-width: 520px) {
    .phone-frame {
        max-width: 100%;
        border-left: none;
        border-right: none;
    }

    .main-tabs {
        display: flex;
        padding: 6px;
    }

    .tab-button {
        min-width: max-content;
        padding: 0 14px;
    }

    .content {
        padding: 16px 14px 24px;
    }

    .theme-switcher {
        right: 14px;
        bottom: 14px;
        width: 48px;
        height: 48px;
    }
}
