:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #18201d;
  background: #f3f5f4;
  font-size: 15px;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.sidebar { background: #151b19; color: #eef4f1; padding: 22px 14px; display: flex; flex-direction: column; min-height: 100vh; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; border-bottom: 1px solid #303835; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; background: #56c18d; color: #102018; font-weight: 800; border-radius: 6px; }
.brand div { display: grid; gap: 2px; }
.brand strong { font-size: 15px; }
.brand span:not(.brand-mark) { color: #98a7a1; font-size: 12px; }
nav { display: grid; gap: 4px; padding-top: 20px; }
.nav-item { border: 0; background: transparent; color: #aebbb6; padding: 10px 12px; text-align: left; border-radius: 5px; }
.nav-item:hover, .nav-item.active { background: #29312e; color: #ffffff; }
.connection { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid #303835; color: #98a7a1; font-size: 12px; display: flex; gap: 8px; align-items: center; }
.connection span { width: 8px; height: 8px; border-radius: 50%; background: #d15a5a; }
.connection.online span { background: #56c18d; }

main { min-width: 0; padding: 24px 30px 40px; }
.topbar { height: 58px; display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid #dce1df; margin-bottom: 24px; }
h1 { margin: 0; font-size: 22px; font-weight: 700; }
.topbar p { margin: 4px 0 0; color: #72807a; font-size: 12px; }
.icon-button { width: 36px; height: 36px; border: 1px solid #cfd6d3; background: #ffffff; border-radius: 5px; font-size: 20px; line-height: 1; }
.icon-button:hover { border-color: #87958f; }

.connect-panel { background: #ffffff; border: 1px solid #dce1df; border-radius: 6px; padding: 18px; margin-bottom: 22px; }
.connect-panel h2 { margin: 0 0 14px; font-size: 15px; }
.connect-grid { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto; gap: 12px; align-items: end; }
label { display: grid; gap: 6px; color: #56635e; font-size: 12px; }
input, select { height: 38px; border: 1px solid #cfd6d3; background: #fff; border-radius: 4px; padding: 0 10px; color: #18201d; }
input:focus, select:focus { outline: 2px solid #b9e6cf; border-color: #3b9a69; }
.primary-button { height: 38px; border: 0; border-radius: 4px; background: #23764e; color: #ffffff; padding: 0 18px; font-weight: 650; }
.primary-button:hover { background: #1b613f; }
.error { color: #ad3232; margin: 10px 0 0; min-height: 18px; font-size: 12px; }

.view { display: none; }
.view.active { display: block; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); border-top: 1px solid #dce1df; border-left: 1px solid #dce1df; }
.metric { min-height: 108px; background: #ffffff; border-right: 1px solid #dce1df; border-bottom: 1px solid #dce1df; padding: 18px; }
.metric span { display: block; color: #6b7873; font-size: 12px; margin-bottom: 13px; }
.metric strong { font-size: 26px; font-weight: 720; }
.metric.alert strong { color: #b23d3d; }

.table-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.table-toolbar select { min-width: 190px; }
.table-wrap { overflow: auto; border: 1px solid #dce1df; background: #ffffff; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: 11px 13px; border-bottom: 1px solid #e6eae8; vertical-align: top; }
th { position: sticky; top: 0; background: #f7f9f8; color: #66736e; font-size: 11px; text-transform: uppercase; font-weight: 700; }
td { font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
.status { display: inline-block; padding: 3px 7px; border-radius: 4px; background: #e9eeec; font-size: 11px; white-space: nowrap; }
.status.failed, .status.rejected { background: #f7dddd; color: #8d2929; }
.status.paid, .status.completed, .status.delivered { background: #dff1e7; color: #276545; }
.empty-row { color: #78857f; text-align: center; padding: 30px; }

@media (max-width: 880px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { min-height: 0; padding: 12px; position: sticky; top: 0; z-index: 3; align-self: start; }
  .brand { display: none; }
  nav { padding: 0; display: flex; overflow-x: auto; }
  .nav-item { white-space: nowrap; }
  .connection { display: none; }
  main { padding: 18px 14px 30px; }
  .connect-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
}

@media (max-width: 480px) {
  .metrics { grid-template-columns: 1fr; }
  .topbar { margin-bottom: 16px; }
}
