:root {
  --brand: #ee4d2d;
  --brand-soft: #ffeeed;
  --ink: #1d2129;
  --muted: #86909c;
  --line: #e5e6eb;
  --bg: #f7f8fa;
  --ok: #00b42a;
  --warn: #ff7d00;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Arial, sans-serif; font-size: 14px;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
img { display: block; max-width: 100%; }

.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: #fff; border-right: 1px solid var(--line); padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; margin-bottom: 20px; padding: 0 8px; }
.brand__mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.brand__mark img { width: 20px; height: 20px; object-fit: contain; }
.nav__icon { width: 18px; height: 18px; opacity: .65; flex: none; }
.nav a.is-active .nav__icon { opacity: 1; }
.nav__badge {
  margin-left: auto; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 999px; display: grid; place-items: center; padding: 0 5px;
}
.nav__badge.is-pulse { animation: badgePulse 1s ease; }
@keyframes badgePulse { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
.nav { display: grid; gap: 4px; }
.nav a { padding: 9px 10px; border-radius: 8px; color: #4e5969; font-weight: 500; display: flex; gap: 9px; align-items: center; }
.nav a:hover { background: #f2f3f5; }
.nav a.is-active { background: var(--brand-soft); color: var(--brand); }
.main { padding: 22px 26px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.topbar h1 { font-size: 20px; margin: 0; }
.topbar__actions { margin-left: auto; display: flex; gap: 8px; }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; display: inline-flex; gap: 7px; align-items: center;
}
.btn:hover { border-color: #c9cdd4; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: #d73211; border-color: #d73211; }
.btn--danger { color: #cb2634; border-color: #ffd2d5; background: #fff5f5; }
.btn--sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat__label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.stat__value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat__hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat--brand .stat__value { color: var(--brand); }

.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.panel__head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel__head h2 { font-size: 15px; margin: 0; }
.panel__head a { margin-left: auto; font-size: 13px; color: var(--brand); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .3px; }
tr:hover td { background: #fcfcfd; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #f2f3f5; color: #4e5969; }
.badge--paid { background: #e8ffea; color: #00a326; }
.badge--pending { background: #fff7e8; color: #d25f00; }
.badge--card { background: #e8f3ff; color: #1668dc; }
.badge--bad { background: #fff0f0; color: #cb2634; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.field label { font-size: 12px; color: #4e5969; font-weight: 600; }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; outline: 0; background: #fff;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(238,77,45,.12); }
.field .hint { font-size: 11px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.toast { position: fixed; right: 18px; bottom: 18px; background: #1d2129; color: #fff; padding: 11px 16px; border-radius: 9px; opacity: 0; transform: translateY(8px); transition: .2s; z-index: 50; }
.toast.is-on { opacity: 1; transform: none; }
.toast--err { background: #cb2634; }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; }
.chart__bar { flex: 1; background: linear-gradient(180deg, #ff9d85, var(--brand)); border-radius: 4px 4px 2px 2px; min-height: 3px; position: relative; }
.chart__bar span { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: 9px; color: var(--muted); }

.card-box { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #fcfcfd; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.kv > div { background: #fff; padding: 9px 12px; font-size: 13px; }
.kv > div:nth-child(odd) { color: var(--muted); background: #fafafa; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #fff, #ffe9e3); padding: 20px; }
.login { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 26px; width: 100%; max-width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,.07); }

.alert { border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.alert--err { background: #fff0f0; color: #cb2634; border: 1px solid #ffd2d5; }
.alert--ok { background: #e8ffea; color: #00701a; border: 1px solid #aff0b5; }
.alert--warn { background: #fff7e8; color: #8a4b00; border: 1px solid #ffe4b8; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 12px; cursor: pointer; }
.tab.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .cards { grid-template-columns: 1fr 1fr; }
  .grid2 { grid-template-columns: 1fr; }
}
