:root {
    --bg: #eef1f0;
    --surface: #ffffff;
    --surface-muted: #f5f7f6;
    --ink: #17201d;
    --muted: #66736e;
    --line: #d8dfdc;
    --brand: #15804a;
    --brand-dark: #0d5f36;
    --danger: #c53a3a;
    --warning: #a96700;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Arial, sans-serif; }
button, input { font: inherit; }

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

.login-layout {
    width: min(760px, 100%);
    display: grid;
    grid-template-columns: 0.85fr 1.15fr;
    overflow: hidden;
    border: 1px solid #34413c;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}

.login-brand-panel {
    min-height: 430px;
    display: flex;
    align-items: flex-end;
    gap: 14px;
    padding: 34px;
    background: var(--brand);
    color: #fff;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    border-radius: 8px;
    background: #fff;
    color: var(--brand-dark);
    font-size: 24px;
    font-weight: 900;
}

.login-brand-panel div:last-child { display: grid; gap: 2px; }
.login-brand-panel strong { font-size: 24px; }
.login-brand-panel span { color: rgba(255, 255, 255, 0.78); font-size: 13px; }

.login-form { display: grid; align-content: center; gap: 20px; padding: 46px; }
.login-form header span, .topbar span, .operator span { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.login-form h1 { margin: 5px 0 0; font-size: 28px; }
.login-form label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 800; }
.login-form input { min-height: 44px; border: 1px solid var(--line); border-radius: 6px; padding: 0 12px; color: var(--ink); }
.login-form input:focus { border-color: var(--brand); outline: 2px solid rgba(21, 128, 74, 0.15); }
.login-form button, .sidebar form button { min-height: 44px; border: 0; border-radius: 6px; background: var(--brand); color: #fff; cursor: pointer; font-weight: 800; }
.login-form button:hover, .sidebar form button:hover { background: var(--brand-dark); }
.alert { padding: 11px 12px; border: 1px solid #efb0b0; border-radius: 6px; background: #fff1f1; color: #9f2525; font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; background: #17201d; color: #fff; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; padding: 0 8px 24px; border-bottom: 1px solid #34413c; }
.brand > span:last-child { display: grid; gap: 2px; }
.brand strong { font-size: 19px; }
.brand small { color: #9caaa5; }
.sidebar nav { display: grid; gap: 6px; margin-top: 24px; }
.sidebar nav a { padding: 11px 12px; border-radius: 6px; color: #b9c5c1; text-decoration: none; font-weight: 700; }
.sidebar nav a:hover, .sidebar nav a.active { background: #26332e; color: #fff; }
.sidebar form { margin-top: auto; }
.sidebar form button { width: 100%; background: #26332e; }

.main-content { min-width: 0; padding: 28px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.topbar h1 { margin: 4px 0 0; font-size: 27px; }
.operator { display: grid; gap: 3px; text-align: right; }
.operator strong { font-size: 14px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.metrics article { min-width: 0; display: grid; gap: 7px; padding: 16px; border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 7px; background: var(--surface); }
.metrics span, .metrics small { color: var(--muted); font-size: 12px; }
.metrics strong { font-size: 22px; overflow-wrap: anywhere; }
.metrics .metric-warning { border-left-color: var(--warning); }

.data-section { margin-bottom: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.data-section > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.data-section h2 { margin: 0; font-size: 18px; }
.data-section header span { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 720px; border-collapse: collapse; }
th { padding: 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; text-align: left; text-transform: uppercase; }
td { padding: 12px 10px; border-bottom: 1px solid #e8ecea; font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td small { color: var(--muted); }
.empty { padding: 30px; color: var(--muted); text-align: center; }
.status { display: inline-flex; padding: 5px 8px; border-radius: 999px; background: #e7ecea; color: #4f5d58; font-size: 11px; font-weight: 800; }
.status-active, .status-completed { background: #e1f4e9; color: var(--brand-dark); }
.status-pending { background: #fff1d8; color: #885400; }
.status-failed, .status-blocked, .status-cancelled { background: #fde7e7; color: #a52626; }
.amount-incoming { color: var(--brand-dark); font-weight: 800; }
.amount-outgoing { color: var(--danger); font-weight: 800; }

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

@media (max-width: 700px) {
    .login-layout { grid-template-columns: 1fr; }
    .login-brand-panel { min-height: 120px; align-items: center; padding: 24px; }
    .login-form { padding: 30px 24px; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; width: 100%; height: auto; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; padding: 14px; }
    .brand { border: 0; padding: 0; }
    .sidebar nav { grid-column: 1 / -1; display: flex; overflow-x: auto; margin: 0; }
    .sidebar form { margin: 0; }
    .sidebar form button { padding: 0 14px; }
    .main-content { padding: 18px 14px; }
    .metrics { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 430px) {
    .metrics { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; }
}
