:root {
    --bg-page: #f4f8fc;
    --bg-surface: #ffffff;
    --bg-surface-soft: #f7fbff;
    --bg-accent-soft: #eaf4ff;

    --primary: #2f80ed;
    --primary-dark: #1f6fd8;
    --secondary: #27ae60;
    --secondary-soft: #eaf8f0;

    --text-main: #1f2d3d;
    --text-soft: #5f7285;
    --text-muted: #7f92a6;

    --border: #dfe8f1;
    --border-strong: #c9d8e6;

    --danger: #eb5757;
    --warning: #f2994a;
    --success: #27ae60;

    --shadow-sm: 0 6px 16px rgba(31, 45, 61, 0.06);
    --shadow-md: 0 16px 38px rgba(31, 45, 61, 0.08);
    --shadow-lg: 0 28px 60px rgba(31, 45, 61, 0.10);

    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 24px;

    --container-max: 1180px;

    --space-1: 6px;
    --space-2: 10px;
    --space-3: 14px;
    --space-4: 18px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 42px;

    --font-xs: 12px;
    --font-sm: 14px;
    --font-md: 16px;
    --font-lg: 18px;
    --font-xl: 24px;
    --font-2xl: 34px;

    --tap-size: 48px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg-page) !important;
    color: var(--text-main);
    font-family: Arial, Helvetica, sans-serif;
}

body {
    font-size: var(--font-md);
    line-height: 1.5;
}

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

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

input,
select,
textarea {
    width: 100%;
    min-height: var(--tap-size);
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(47, 128, 237, 0.10);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.btn-primary,
.btn-secondary,
.btn-linklike {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--tap-size);
    padding: 12px 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-weight: 700;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-linklike:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(47, 128, 237, 0.18);
}

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

.btn-secondary {
    background: #ffffff;
    color: var(--text-main);
    border-color: var(--border);
}

.btn-linklike {
    background: transparent;
    color: var(--primary);
    padding-left: 0;
    padding-right: 0;
    min-height: auto;
    justify-content: flex-start;
}

/* LOGIN PAGE */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background:
        radial-gradient(circle at top left, rgba(47, 128, 237, 0.08) 0%, transparent 35%),
        radial-gradient(circle at bottom right, rgba(39, 174, 96, 0.08) 0%, transparent 35%),
        var(--bg-page) !important;
}

.auth-shell {
    width: 100%;
    max-width: var(--container-max);
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.auth-panel,
.auth-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.auth-panel {
    padding: 24px;
    background:
        linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.auth-brand {
    margin-bottom: 22px;
}

.auth-brand h1 {
    margin: 0;
    font-size: clamp(34px, 5vw, 50px);
    line-height: 1.05;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.auth-brand p {
    margin: 10px 0 0;
    color: var(--text-soft);
    font-size: var(--font-lg);
}

.auth-feature-list {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.auth-feature-item {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 14px;
    align-items: start;
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--bg-surface-soft);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.auth-feature-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-accent-soft);
    color: var(--primary);
    font-size: 22px;
    font-weight: 700;
}

.auth-feature-item h3 {
    margin: 0 0 6px;
    font-size: 17px;
    line-height: 1.2;
}

.auth-feature-item p {
    margin: 0;
    color: var(--text-soft);
    font-size: var(--font-sm);
}

.auth-note {
    margin-top: 22px;
    padding: 14px 16px;
    border-radius: 14px;
    background: #fffdf6;
    border: 1px solid #f3dfb6;
    color: #8a6b1f;
    font-size: var(--font-sm);
}

.auth-card {
    padding: 26px;
    align-self: center;
}

.auth-card-header {
    margin-bottom: 18px;
}

.auth-card-header h2 {
    margin: 0;
    font-size: clamp(28px, 4vw, 34px);
    line-height: 1.1;
}

.auth-card-header p {
    margin: 8px 0 0;
    color: var(--text-soft);
    font-size: var(--font-md);
}

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

.form-row {
    display: grid;
    gap: 8px;
}

.form-row label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

.form-actions {
    display: grid;
    gap: 12px;
    margin-top: 4px;
}

.form-message {
    min-height: 24px;
    margin-top: 14px;
    font-size: 14px;
    color: var(--text-soft);
}

.auth-extra {
    margin-top: 16px;
    display: grid;
    gap: 10px;
}

.auth-disclaimer {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.5;
}

/* GENERIC APP */
.app-shell {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

.topbar {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.topbar h1 {
    margin: 0;
    font-size: clamp(24px, 4vw, 34px);
}

.topbar p {
    margin: 0;
    color: var(--text-soft);
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 18px;
}

.card h2 {
    margin: 0 0 12px;
    font-size: 22px;
}

.status-card {
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.reading-big {
    display: grid;
    gap: 8px;
}

.reading-big strong {
    font-size: clamp(30px, 6vw, 48px);
    line-height: 1;
}

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

.action-tile {
    display: block;
    min-height: 76px;
    padding: 16px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    color: var(--text-main);
    font-weight: 700;
}

.action-tile:hover {
    border-color: var(--border-strong);
    text-decoration: none;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.medical-table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    background: #ffffff;
}

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

.medical-table th {
    background: #f7fbff;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-size: 12px;
}

.mobile-reading-list {
    display: grid;
    gap: 12px;
}

.mobile-reading-card {
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #ffffff;
    box-shadow: var(--shadow-sm);
}

.mobile-reading-card .row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.mobile-reading-card .label {
    color: var(--text-soft);
    font-size: 13px;
}

.mobile-reading-card .value {
    color: var(--text-main);
    font-weight: 700;
    text-align: right;
}

.only-mobile {
    display: block;
}

.hidden-mobile {
    display: none;
}

/* RESPONSIVE */
@media (min-width: 768px) {
    .auth-shell {
        grid-template-columns: 1.1fr 0.9fr;
        gap: 22px;
    }

    .form-actions {
        grid-template-columns: 1fr;
    }

    .action-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .topbar {
        grid-template-columns: 1fr auto;
        align-items: center;
    }

    .content-grid {
        grid-template-columns: 1.1fr 0.9fr;
    }

    .content-grid > .card:nth-child(3) {
        grid-column: 1 / -1;
    }

    .action-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .only-mobile {
        display: none;
    }

    .hidden-mobile {
        display: block;
    }
}

@media (max-width: 767px) {
    .auth-page {
        padding: 14px;
    }

    .auth-panel,
    .auth-card,
    .card {
        padding: 18px;
        border-radius: 18px;
    }

    .auth-feature-item {
        grid-template-columns: 44px 1fr;
        padding: 14px;
    }

    .auth-feature-icon {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}
