/* ===== THEMES ===== */

html.light {
    --bg: #f4f6f8;
    --text: #111827;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --topbar-bg: #ffffff;
    --link: #2563eb;
}

html.dark {
    --bg: #0b1120;
    --text: #e5e7eb;
    --card-bg: #020617;
    --border: #1f2937;
    --topbar-bg: #020617;
    --link: #60a5fa;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial;
}

/* ===== TOPBAR ===== */

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

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-left .logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.topbar-left .title {
    font-weight: 600;
    font-size: 16px;
}

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

.topbar-right a {
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 999px;
}

.topbar-right a:hover {
    background: rgba(148,163,184,0.24);
}

.logout-link {
    color: #dc2626 !important;
    font-weight: 600;
}

/* маленькие кнопки для темы */
.btn-icon {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: var(--text);
}

.btn-icon:hover {
    background: rgba(148,163,184,0.2);
}

/* ===== LAYOUT ===== */

.page-wrap {
    padding: 20px;
    max-width: 1280px;
    margin: 0 auto 64px auto;
}

/* ===== CARDS ===== */

.card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 18px 20px;
    box-shadow: 0 10px 40px rgba(15,23,42,0.08);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-header h2,
.card-header h3 {
    margin: 0;
    font-size: 18px;
}

.card-sub {
    font-size: 13px;
    color: #6b7280;
}

/* ===== TABLES ===== */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

th, td {
    padding: 8px 8px;
    border-bottom: 1px solid var(--border);
}

th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

/* ===== BUTTONS ===== */

button,
.btn {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
}

button.red,
.btn.red {
    background: #dc2626;
}

button.grey,
.btn.grey {
    background: #6b7280;
}

button.green,
.btn.green {
    background: #16a34a;
}

button:disabled {
    opacity: 0.6;
    cursor: default;
}

/* ===== FORMS ===== */

input[type=text],
input[type=password],
input[type=number],
select {
    width: 100%;
    max-width: 260px;
    padding: 7px 9px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    font-size: 14px;
    box-sizing: border-box;
}

label {
    font-size: 13px;
    display: block;
    margin-bottom: 4px;
}

/* ===== MOBILE BOTTOM NAV ===== */

.mobile-bottom {
    display: none;
}

@media (max-width: 768px) {
    .page-wrap {
        padding: 12px;
        margin-bottom: 64px;
    }

    .topbar-right a {
        display: none;
    }
    .topbar-right .btn-icon,
    .topbar-right .logout-link {
        display: inline-flex;
    }

    .mobile-bottom {
        display: flex;
        justify-content: space-around;
        align-items: center;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--card-bg);
        border-top: 1px solid var(--border);
        padding: 8px 0;
        z-index: 100;
    }

    .mobile-bottom a {
        text-decoration: none;
        font-size: 22px;
        color: var(--text);
    }
}

/* Tags / pills */
.tag {
    display:inline-block;
    padding:3px 7px;
    border-radius:999px;
    background: rgba(148,163,184,0.2);
    font-size:11px;
}

/* Profit / Loss */
.profit { color:#16a34a; }
.loss   { color:#dc2626; }

/* Small helper */
.muted { font-size:12px; color:#6b7280; }
.link  { color:var(--link); text-decoration:none; }
.link:hover { text-decoration:underline; }

/* ==== order panel styles (moved from bot/layout.php) ==== */
.order-tabs {
    display:flex; gap:8px; margin-bottom:12px;
}
.order-tab {
    flex:1;
    padding:10px;
    border-radius:6px;
    border:1px solid var(--border);
    background:var(--bg2);
    cursor:pointer;
    text-align:center;
}
.order-tab.active {
    background:var(--accent);
    color:white;
    border-color:var(--accent);
}
.order-block .row {
    margin-bottom:12px;
    display:flex;
    flex-direction:column;
}
.order-block input {
    padding:10px;
    border-radius:6px;
    border:1px solid var(--border);
    background:var(--bg2);
    color:var(--text);
}
#terminal-card button {
    width:48%;
}
