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

:root {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color-scheme: dark;
    --bg: #06131d;
    --surface: rgba(13, 31, 44, 0.9);
    --surface-2: rgba(19, 42, 58, 0.92);
    --line: rgba(255, 255, 255, 0.09);
    --text: #f4f9fc;
    --muted: #8ea5b6;
    --accent: #45d6ff;
    --success: #5ce0a6;
    --danger: #ff7f85;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at 12% 0%, rgba(69, 214, 255, 0.18), transparent 32%),
        radial-gradient(circle at 100% 100%, rgba(58, 112, 255, 0.1), transparent 30%),
        var(--bg);
    color: var(--text);
}

body {
    min-height: 100vh;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.board-page {
    overflow: hidden;
}

.board-shell {
    width: min(100%, 1440px);
    height: 100vh;
    margin: 0 auto;
    padding: clamp(14px, 2vw, 28px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: clamp(12px, 1.6vw, 22px);
}

.board-header,
.rates-panel,
.board-footer,
.admin-header,
.admin-card,
.history-card,
.login-card {
    border: 1px solid var(--line);
    background: rgba(8, 24, 35, 0.78);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(18px);
}

.board-header {
    border-radius: clamp(18px, 2vw, 28px);
    padding: clamp(18px, 2.2vw, 30px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.eyebrow {
    display: block;
    margin-bottom: 7px;
    color: var(--accent);
    font-size: clamp(11px, 1vw, 14px);
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

.board-title h1,
.admin-header h1,
.login-card h1 {
    margin-bottom: 0;
    font-size: clamp(30px, 4.2vw, 64px);
    line-height: 0.95;
    letter-spacing: -0.055em;
}

.board-clock {
    text-align: right;
}

.board-clock strong {
    display: block;
    font-size: clamp(38px, 5.2vw, 76px);
    line-height: 0.9;
    letter-spacing: -0.065em;
    font-variant-numeric: tabular-nums;
}

.board-clock span {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: clamp(12px, 1.3vw, 18px);
}

.rates-panel {
    min-height: 0;
    overflow: hidden;
    border-radius: clamp(20px, 2.3vw, 32px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.rates-head,
.rate-row {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(150px, 0.58fr) minmax(150px, 0.58fr);
    align-items: center;
}

.rates-head {
    padding: clamp(14px, 1.6vw, 20px) clamp(18px, 2.5vw, 34px);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: clamp(11px, 1.05vw, 14px);
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.rates-head span:not(:first-child) {
    text-align: right;
}

.rates-list {
    min-height: 0;
    display: grid;
    grid-auto-rows: minmax(0, 1fr);
}

.rate-row {
    min-height: 0;
    padding: clamp(10px, 1.25vw, 19px) clamp(18px, 2.5vw, 34px);
    border-bottom: 1px solid var(--line);
    transition: background 0.25s ease;
}

.rate-row:last-child {
    border-bottom: 0;
}

.rate-row.changed {
    background: rgba(69, 214, 255, 0.12);
}

.currency-cell {
    display: flex;
    align-items: center;
    gap: clamp(13px, 1.8vw, 24px);
    min-width: 0;
}

.flag {
    flex: 0 0 auto;
    font-size: clamp(34px, 4vw, 58px);
    line-height: 1;
}

.currency-copy {
    min-width: 0;
}

.currency-copy strong {
    display: block;
    font-size: clamp(24px, 3.1vw, 48px);
    line-height: 0.95;
    letter-spacing: -0.045em;
}

.currency-copy span {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: clamp(11px, 1.2vw, 17px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rate-value {
    text-align: right;
    font-size: clamp(30px, 4.5vw, 66px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.055em;
    font-variant-numeric: tabular-nums;
}

.board-footer {
    min-height: 50px;
    border-radius: 17px;
    padding: 11px 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    color: var(--muted);
    font-size: 13px;
}

.connection {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.connection::before {
    content: '';
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 12px currentColor;
}

.connection.online {
    color: var(--success);
}

.connection.offline {
    color: var(--danger);
}

.loading {
    min-height: 100%;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: clamp(16px, 2vw, 22px);
}

.admin-page {
    padding: 28px 18px 60px;
}

.admin-shell {
    width: min(1180px, 100%);
    margin: 0 auto;
}

.admin-header {
    border-radius: 26px;
    padding: 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
}

.admin-header h1 {
    font-size: clamp(30px, 4vw, 48px);
}

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

.button,
.icon-button {
    border: 0;
    cursor: pointer;
    text-decoration: none;
}

.button {
    min-height: 44px;
    padding: 11px 17px;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.button.primary {
    background: var(--accent);
    color: #00131c;
}

.button.secondary {
    color: var(--text);
    background: rgba(255, 255, 255, 0.065);
    border: 1px solid var(--line);
}

.admin-card,
.history-card {
    border-radius: 24px;
    overflow: hidden;
}

.admin-grid {
    display: grid;
    grid-template-columns: 78px 90px minmax(170px, 1fr) 115px 115px 95px 96px 46px;
    gap: 10px;
    align-items: center;
}

.admin-grid-head {
    padding: 14px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--line);
}

.admin-grid-row {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

.admin-grid-row:last-child {
    border-bottom: 0;
}

.field {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 10px 11px;
    background: rgba(255, 255, 255, 0.055);
    color: var(--text);
    outline: none;
}

.field:focus {
    border-color: rgba(69, 214, 255, 0.58);
    box-shadow: 0 0 0 3px rgba(69, 214, 255, 0.1);
}

.numeric {
    font-variant-numeric: tabular-nums;
}

.flag-field {
    text-align: center;
    font-size: 24px;
}

.switch-wrap {
    display: flex;
    justify-content: center;
}

.switch-wrap input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch {
    position: relative;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    cursor: pointer;
    transition: 0.2s ease;
}

.switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: 0.2s ease;
}

.switch-wrap input:checked + .switch {
    background: var(--accent);
}

.switch-wrap input:checked + .switch::after {
    transform: translateX(18px);
}

.sort-buttons {
    display: flex;
    gap: 5px;
}

.icon-button {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--line);
    font-size: 18px;
}

.icon-button.danger {
    color: #ffb0b4;
    background: rgba(255, 127, 133, 0.1);
    border-color: rgba(255, 127, 133, 0.24);
}

.admin-actions-row {
    margin: 17px 0 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.form-message {
    min-height: 20px;
    margin: 0;
    color: var(--danger);
}

.form-message.success {
    color: var(--success);
}

.history-card {
    padding: 22px;
}

.section-heading h2 {
    margin-bottom: 18px;
    font-size: 24px;
    letter-spacing: -0.035em;
}

.history-list {
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
}

.history-item,
.history-empty {
    padding: 13px 15px;
}

.history-item {
    display: grid;
    grid-template-columns: 155px 1fr;
    gap: 18px;
    border-bottom: 1px solid var(--line);
}

.history-item:last-child {
    border-bottom: 0;
}

.history-item time,
.history-empty {
    color: var(--muted);
}

.login-wrap {
    min-height: calc(100vh - 88px);
    display: grid;
    place-items: center;
}

.login-card {
    width: min(430px, 100%);
    padding: 28px;
    border-radius: 25px;
}

.login-card h1 {
    margin-bottom: 26px;
    font-size: 40px;
}

.login-card label {
    display: grid;
    gap: 7px;
    margin-bottom: 14px;
    color: var(--muted);
    font-size: 13px;
}

.login-card .button {
    width: 100%;
    margin-top: 5px;
}

.login-card .form-message {
    margin-top: 13px;
}

[hidden] {
    display: none !important;
}

@media (max-width: 920px) {
    .admin-card {
        overflow-x: auto;
    }

    .admin-grid {
        min-width: 900px;
    }
}

@media (max-width: 700px) {
    .board-shell {
        padding: 10px;
        gap: 10px;
    }

    .board-header {
        padding: 14px 16px;
    }

    .rates-head,
    .rate-row {
        grid-template-columns: minmax(0, 1.25fr) minmax(105px, 0.5fr) minmax(105px, 0.5fr);
    }

    .board-footer {
        min-height: 44px;
    }

    .admin-header,
    .admin-actions-row {
        align-items: flex-start;
        flex-direction: column;
    }
}
