:root {
    --navy: #172b45;
    --navy-soft: #294462;
    --gold: #bd8836;
    --gold-light: #fbf4e7;
    --blue: #3475ae;
    --green: #168351;
    --muted: #8190a4;
    --border: #e7ebf1;
    --surface: #ffffff;
    --background: #f4f6fa;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--background);
    color: var(--navy);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }

.topbar {
    height: 70px;
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 14px;
    font-weight: 850;
    letter-spacing: 1.3px;
}

.brand-link small {
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 1.4px;
    border-left: 1px solid var(--border);
    padding-left: 12px;
}

.brand-diamond { color: var(--gold); font-size: 21px; }

.topbar-right { display: flex; align-items: center; gap: 20px; }
.admin-name { font-size: 13px; font-weight: 600; }

.logout-button {
    border: 1px solid var(--border);
    background: white;
    border-radius: 8px;
    padding: 9px 15px;
    color: var(--navy);
    cursor: pointer;
}

.dashboard-layout { display: flex; min-height: calc(100vh - 70px); }

.sidebar {
    width: 238px;
    flex-shrink: 0;
    padding: 27px 16px;
    background: #fff;
    border-right: 1px solid var(--border);
    position: relative;
}

.side-label, .eyebrow {
    font-size: 10px;
    letter-spacing: 1.8px;
    font-weight: 800;
    color: var(--muted);
}

.side-label { padding: 0 12px; margin-bottom: 12px; }

.nav-item {
    display: block;
    padding: 13px 12px;
    margin: 3px 0;
    border-radius: 9px;
    font-size: 13px;
    color: #586a80;
}

.nav-item.active {
    background: #f0f4fa;
    color: var(--navy);
    font-weight: 700;
}

.nav-item.disabled { opacity: .56; cursor: default; }

.side-space { margin-top: 33px; }

.sidebar-bottom {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fbfcfe;
}

.sidebar-bottom img { width: 42px; height: 42px; }
.sidebar-bottom strong, .sidebar-bottom small { display: block; }
.sidebar-bottom strong { font-size: 12px; }
.sidebar-bottom small { font-size: 10px; color: var(--muted); margin-top: 4px; }

.main-content {
    min-width: 0;
    width: 100%;
    max-width: 1500px;
    padding: 34px 38px;
    margin: 0 auto;
}

.page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 25px;
}

h1 { font-size: clamp(23px, 3vw, 30px); margin: 10px 0 5px; }
h2 { font-size: 20px; margin: 0; }
h3 { font-size: 17px; margin: 12px 0 8px; }
p { color: var(--muted); line-height: 1.65; }

.page-heading p { margin: 5px 0; font-size: 13px; }

.status-pill, .mode-status {
    color: var(--green);
    background: #edf8f2;
    padding: 8px 12px;
    border-radius: 30px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
    white-space: nowrap;
}

.hero-panel {
    min-height: 260px;
    padding: 30px 38px;
    border-radius: 17px;
    background: linear-gradient(110deg, #fff 0%, #fbf8f1 65%, #f5eedf 100%);
    border: 1px solid #e9e1d3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    overflow: hidden;
}

.hero-copy { max-width: 590px; }
.gold-text { color: var(--gold); }

.hero-panel h2 {
    font-size: clamp(23px, 3vw, 34px);
    line-height: 1.25;
    margin: 13px 0;
}

.hero-panel p { max-width: 510px; font-size: 13px; }

.hero-tag {
    display: inline-block;
    color: var(--navy-soft);
    background: #fff;
    border: 1px solid #eee5d6;
    border-radius: 6px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 10px 13px;
    margin-top: 10px;
}

.hero-mascot {
    min-width: 165px;
    text-align: center;
}

.hero-mascot img { width: 150px; max-width: 100%; }
.hero-mascot span { display: block; font-size: 10px; font-weight: 800; letter-spacing: 2px; color: var(--gold); }

.section-heading { margin: 32px 0 16px; }
.section-heading p { margin: 5px 0; font-size: 12px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
}

.stat-card, .mode-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 3px 12px rgba(30, 55, 90, .025);
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 1.2px;
    font-weight: 800;
}

.stat-card strong {
    display: block;
    margin-top: 13px;
    font-size: 29px;
}

.stat-card small { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }

.mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.mode-card { min-height: 230px; }

.mode-card p { font-size: 12px; max-width: 440px; }
.mode-status { display: inline-block; font-size: 8px; margin-top: 10px; }

.mode-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    margin-bottom: 20px;
    border-radius: 10px;
    font-size: 20px;
}

.blue-icon { background: #edf4fb; color: var(--blue); }
.gold-icon { background: var(--gold-light); color: var(--gold); }

.notice {
    background: #fff;
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold);
    border-radius: 8px;
    padding: 15px 17px;
    margin-top: 22px;
    color: #68778b;
    font-size: 11px;
    line-height: 1.6;
}

.notice strong { color: var(--navy); }

.dashboard-footer {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-top: 36px;
    padding: 20px 0;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .5px;
}

/* Login */

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 25px;
    background: #f3f6fa;
}

.login-layout {
    width: 100%;
    max-width: 1000px;
    min-height: 570px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: white;
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 18px 55px rgba(25, 45, 75, .08);
}

.login-brand {
    padding: 45px;
    background: linear-gradient(145deg, #fff, #f8f2e8);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.login-brand .brand-logo {
    font-size: 17px;
    font-weight: 900;
    letter-spacing: 2px;
}

.brand-caption {
    margin-top: 8px;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 2px;
}

.login-mascot {
    display: block;
    width: 155px;
    margin: 35px auto 25px;
    align-self: center;
}

.login-brand h1 { font-size: 27px; }
.login-brand p { font-size: 13px; }

.login-footer {
    margin-top: auto;
    color: var(--gold);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.7px;
}

.login-panel {
    padding: 60px 45px;
    align-self: center;
}

.login-panel h2 { font-size: 28px; margin-top: 12px; }
.login-panel .muted { font-size: 12px; margin-bottom: 30px; }
.login-panel label { display: block; margin: 19px 0 8px; font-size: 12px; font-weight: 700; }

.login-panel input {
    width: 100%;
    border: 1px solid #dfe5ed;
    border-radius: 8px;
    padding: 13px;
    font-size: 13px;
    outline: none;
}

.login-panel input:focus { border-color: #9aafc7; }

.primary-button {
    width: 100%;
    margin-top: 25px;
    padding: 14px;
    border: 0;
    border-radius: 8px;
    background: var(--navy);
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.primary-button:hover { background: #264361; }

.alert-error {
    padding: 12px;
    border-radius: 7px;
    background: #fff0ef;
    color: #ac332c;
    font-size: 12px;
}

.login-security {
    margin-top: 25px;
    font-size: 11px;
    color: var(--muted);
}

.login-security span { color: var(--green); }

@media(max-width: 1000px) {
    .sidebar { width: 205px; }
    .main-content { padding: 26px 22px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media(max-width: 700px) {
    .topbar { height: 62px; padding: 0 15px; }
    .brand-link { font-size: 11px; gap: 5px; }
    .brand-link small { display: none; }
    .admin-name { display: none; }
    .dashboard-layout { display: block; }
    .sidebar { display: none; }
    .main-content { padding: 23px 15px; }
    .page-heading { align-items: flex-start; }
    .hero-panel { padding: 22px; min-height: 230px; }
    .hero-mascot { min-width: 90px; }
    .hero-mascot img { width: 95px; }
    .hero-panel p { font-size: 11px; }
    .stats-grid { gap: 9px; }
    .stat-card { padding: 14px; }
    .stat-card strong { font-size: 24px; }
    .stat-card small { font-size: 10px; }
    .mode-grid { grid-template-columns: 1fr; }
    .dashboard-footer { flex-direction: column; }
    .login-layout { grid-template-columns: 1fr; }
    .login-brand { padding: 25px; }
    .login-mascot { width: 105px; margin: 18px auto; }
    .login-brand h1 { font-size: 22px; }
    .login-panel { padding: 30px 25px; }
}

/* API settings */
.settings-form {
    display: grid;
    gap: 17px;
    max-width: 1000px;
}

.settings-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 24px;
}

.settings-card h2 { margin-top: 9px; }
.settings-card > p { font-size: 12px; }

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 20px;
    margin-top: 22px;
}

.field label,
.credential-heading label {
    display: block;
    color: var(--navy);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 9px;
}

.field select,
.credential-field input:not([type=checkbox]) {
    width: 100%;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fbfcfe;
    padding: 0 12px;
    color: var(--navy);
    outline: none;
    font-size: 12px;
}

.credential-field {
    padding: 19px 0;
    border-bottom: 1px solid var(--border);
}

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

.configured, .not-configured {
    font-size: 10px;
    font-weight: 700;
}

.configured { color: var(--green); }
.not-configured { color: var(--muted); }

.clear-secret {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #a64040;
    font-size: 11px;
    margin-top: 12px;
}

.settings-actions {
    max-width: 300px;
}

.success-notice {
    border-left: 3px solid var(--green);
    background: #edf8f2;
}

.error-notice {
    border-left: 3px solid #b83e3e;
    background: #fff3f1;
}

@media(max-width:700px) {
    .settings-card { padding: 17px; }
    .settings-grid { grid-template-columns: 1fr; gap: 17px; }
    .credential-heading { align-items: flex-start; }
}

/* Market universe */
.market-action-grid {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 14px;
}

.market-action-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 21px;
}

.market-action-card h3 { margin-top: 11px; }
.market-action-card p { font-size: 12px; min-height: 55px; }

.market-action-card form { margin-top: 12px; }

.market-action-card .primary-button,
.secondary-button {
    display: block;
    width: 100%;
    min-height: 41px;
    margin-top: 0;
    padding: 10px;
    border-radius: 8px;
    font-size: 11px;
}

.secondary-button {
    margin-top: 9px;
    background: #f1f5f9;
    color: var(--navy);
    border: 1px solid var(--border);
    cursor: pointer;
    font-weight: 700;
}

.market-action-card input {
    width: 100%;
    height: 42px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.market-action-card small {
    display: block;
    color: var(--muted);
    font-size: 10px;
    margin-top: 8px;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.market-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 900px;
    font-size: 11px;
    text-align: left;
}

.market-table th {
    padding: 15px 13px;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: .8px;
    background: #fafbfd;
    white-space: nowrap;
}

.market-table td {
    padding: 14px 13px;
    border-top: 1px solid #edf0f5;
    white-space: nowrap;
}

.market-table td:first-child strong,
.market-table td:first-child small {
    display: block;
}

.market-table td:first-child strong { font-size: 12px; }
.market-table td:first-child small {
    color: var(--muted);
    margin-top: 4px;
}

.asset-class {
    padding: 5px 8px;
    background: #f0f4fa;
    border-radius: 5px;
    color: var(--navy-soft);
    font-size: 9px;
    font-weight: 800;
}

.price-cell {
    font-weight: 800;
    color: var(--navy);
}

.empty-table {
    text-align: center;
    color: var(--muted);
    white-space: normal !important;
    padding: 35px !important;
}

@media(max-width:900px) {
    .market-action-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media(max-width:600px) {
    .market-action-grid { grid-template-columns: 1fr; }
}
