:root {
  --navy: #17365d;
  --navy-2: #102846;
  --blue: #2668b2;
  --pale: #eef4fb;
  --line: #d7e0ea;
  --text: #10233f;
  --muted: #62738a;
  --danger: #b42318;
  --danger-bg: #feeceb;
  --amber: #9a6700;
  --amber-bg: #fff5d6;
  --green: #157347;
  --green-bg: #e8f5ee;
  --shadow: 0 12px 30px rgba(16, 40, 70, .12);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Arial, Helvetica, sans-serif; color: var(--text); background: #f3f6fa; }
body { min-width: 1024px; overflow: hidden; }
.topbar { height: 88px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: var(--navy); color: white; box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 18px; height: 100%; }
.brand img { width: 220px; max-height: 66px; object-fit: contain; object-position: left center; }
.divider { width: 1px; height: 48px; background: rgba(255,255,255,.35); }
.product { font-size: 30px; font-weight: 800; letter-spacing: .06em; }
.subtitle { margin-top: 3px; font-size: 15px; opacity: .82; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.refresh-meta { display: grid; text-align: right; font-size: 13px; line-height: 1.45; color: #dce7f4; }
.refresh-button { width: 52px; height: 52px; border-radius: 15px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.08); color: white; font-size: 28px; cursor: pointer; }
.refresh-button:hover { background: rgba(255,255,255,.16); }
.dashboard-shell { height: calc(100vh - 88px); padding: 16px 20px 18px; overflow: hidden; }
.alert-strip { min-height: 44px; margin-bottom: 12px; padding: 11px 16px; border: 1px solid #f4b4ad; border-radius: 12px; background: var(--danger-bg); color: var(--danger); font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.hidden { display: none !important; }
.metric-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 12px; }
.metric-card { min-height: 76px; padding: 14px 18px; background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 5px 16px rgba(16,40,70,.07); display: flex; align-items: center; justify-content: space-between; }
.metric-card span { color: var(--muted); font-size: 14px; font-weight: 700; }
.metric-card strong { font-size: 30px; color: var(--navy); }
.metric-card.warning strong { color: var(--danger); }
.workspace-grid { height: calc(100% - 100px); display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(340px, .9fr); gap: 12px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 5px 16px rgba(16,40,70,.07); overflow: hidden; }
.open-panel { display: flex; flex-direction: column; min-width: 0; }
.panel-heading { min-height: 76px; padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.panel-heading.compact { min-height: 62px; }
h1, h2, p { margin: 0; }
h1 { font-size: 21px; }
h2 { font-size: 17px; }
.panel-heading p { margin-top: 4px; font-size: 13px; color: var(--muted); }
.panel-heading input { width: min(390px, 46%); height: 40px; padding: 0 13px; border: 1px solid #b9c7d7; border-radius: 10px; font-size: 14px; }
.table-wrap { flex: 1; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { position: sticky; top: 0; z-index: 2; padding: 10px 11px; text-align: left; color: #4b5d74; background: #f6f8fb; border-bottom: 1px solid var(--line); }
td { padding: 10px 11px; border-bottom: 1px solid #e8edf3; vertical-align: top; }
tbody tr:hover { background: #f7faff; }
tr.overdue { background: #fff3f2; }
tr.overdue:hover { background: #fee9e7; }
.age-badge { display: inline-flex; min-width: 68px; justify-content: center; padding: 5px 8px; border-radius: 999px; background: var(--pale); color: var(--navy); font-weight: 800; white-space: nowrap; }
.age-badge.overdue { background: #ffd8d4; color: var(--danger); }
.cell-main { font-weight: 700; }
.cell-sub { margin-top: 3px; color: var(--muted); font-size: 12px; }
.side-column { display: grid; grid-template-rows: 1.25fr .75fr; gap: 12px; min-height: 0; }
.trolley-panel, .recent-panel { display: flex; flex-direction: column; min-height: 0; }
.trolley-status, .recent-list { overflow: auto; padding: 10px 12px; }
.trolley-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.trolley-item.out { border-left: 5px solid var(--amber); background: #fffcf2; }
.trolley-item .name { font-weight: 800; font-size: 13px; }
.trolley-item .detail { margin-top: 3px; color: var(--muted); font-size: 12px; }
.status-pill { align-self: center; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.status-pill.out { color: var(--amber); background: var(--amber-bg); }
.return-item { padding: 10px 4px; border-bottom: 1px solid #e7edf4; }
.return-item:last-child { border-bottom: 0; }
.return-item strong { display: block; font-size: 13px; }
.return-item span { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.empty-state { padding: 26px 14px; text-align: center; color: var(--muted); }
.toast { position: fixed; right: 20px; bottom: 18px; max-width: 420px; padding: 12px 16px; border-radius: 10px; background: var(--navy-2); color: white; box-shadow: var(--shadow); font-size: 13px; }
@media (max-height: 720px) {
  .topbar { height: 78px; }
  .dashboard-shell { height: calc(100vh - 78px); padding-top: 12px; }
  .metric-card { min-height: 66px; }
  .workspace-grid { height: calc(100% - 90px); }
}
.telegram-status { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; background: rgba(255,255,255,.08); color: #e8f1fb; font-size: 12px; font-weight: 700; white-space: nowrap; }
.telegram-dot { width: 9px; height: 9px; border-radius: 50%; background: #f4c95d; box-shadow: 0 0 0 4px rgba(244,201,93,.14); }
.telegram-status.online .telegram-dot { background: #5bd39a; box-shadow: 0 0 0 4px rgba(91,211,154,.15); }
.telegram-status.offline .telegram-dot { background: #ff8b7f; box-shadow: 0 0 0 4px rgba(255,139,127,.15); }
@media (max-width: 1180px) { .telegram-status { display: none; } }

.contact-button { display: inline-flex; align-items: center; justify-content: center; min-width: 78px; padding: 7px 10px; border-radius: 9px; background: #157347; color: #fff; font-weight: 800; text-decoration: none; white-space: nowrap; }
.contact-button:hover { background: #105c39; }
.contact-missing { color: var(--muted); font-size: 12px; white-space: nowrap; }
