:root {
  color-scheme: dark;
  --bg: #101827;
  --surface: #182338;
  --surface-light: #22314b;
  --text: #edf3ff;
  --muted: #aab8cf;
  --accent: #63d4aa;
  --accent-dark: #1f9b75;
  --danger: #ed5c69;
  --border: #31425f;
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; max-width: 100%; overflow-x: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button {
  font: inherit;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.app-shell {
  width: min(100%, 1100px);
  min-width: 0;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
}

.app-footer { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.footer-links strong { color: var(--text); font-size: 12px; letter-spacing: .08em; }
.footer-links a { display: inline-flex; align-items: center; min-height: 36px; text-decoration-thickness: 2px; text-underline-offset: 3px; -webkit-tap-highlight-color: #63d4aa44; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}

.topbar-actions { min-width: 0; }
.mobile-menu-hint { display: none; }

@media (max-width: 680px) {
  .app-shell { padding-inline: 16px; }
  .topbar { display: grid; grid-template-columns: 1fr; gap: 12px; }
  .topbar-actions { display: flex; width: 100%; padding-bottom: 4px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .topbar-actions::-webkit-scrollbar { display: none; }
  .topbar-actions > * { flex: 0 0 auto; }
  .language-picker { position: sticky; left: 0; z-index: 1; padding-right: 4px; background: var(--bg); }
  .mobile-menu-hint { display: block; margin: -7px 0 0; color: var(--accent); font-size: 12px; font-weight: 700; text-align: right; }
  .app-footer { display: grid; gap: 18px; padding-top: 28px; }
  .footer-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .footer-links strong { grid-column: 1 / -1; padding-bottom: 3px; }
  .footer-links a { min-height: 48px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); line-height: 1.2; }
  .footer-links a:active { border-color: var(--accent); background: #173d32; }
}

.language-picker select { min-height: 38px; max-width: 145px; padding: 0 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  letter-spacing: .04em;
  text-decoration: none;
}

.brand-mark { color: var(--accent); }

.icon-button {
  position: relative;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 25px;
}

.icon-button.is-active { border-color: var(--accent); background: #173d32; color: var(--accent); box-shadow: inset 0 0 0 1px #63d4aa66, 0 0 14px #63d4aa33; }

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 1px 5px;
  border: 2px solid var(--bg);
  border-radius: 20px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  line-height: 14px;
}

.command-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 1px 5px; border: 2px solid var(--bg); border-radius: 20px; background: var(--accent); color: #071e17; font-size: 11px; font-weight: 800; line-height: 14px; }

.button,
.text-button {
  border: 0;
  border-radius: 10px;
  font-weight: 700;
}

.button {
  min-height: 48px;
  padding: 12px 18px;
}

.button-primary {
  background: var(--accent);
  color: #071e17;
}

.button-secondary {
  background: var(--surface-light);
  color: var(--text);
}

.button-danger {
  border: 1px solid #8d3542;
  background: #4a202b;
  color: #ffdfe3;
}

.button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.text-button {
  padding: 6px;
  background: transparent;
  color: var(--accent);
}

.notification-panel {
  position: fixed;
  z-index: 10;
  top: 72px;
  right: max(20px, env(safe-area-inset-right));
  width: min(360px, calc(100vw - 40px));
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 20px 40px #050a14aa;
}

.command-panel { position: fixed; z-index: 10; top: 72px; right: max(20px, env(safe-area-inset-right)); width: min(360px, calc(100vw - 40px)); padding: 16px; border: 1px solid #496b8d; border-radius: 14px; background: var(--surface); box-shadow: 0 20px 40px #050a14aa; }
.command-list { display: grid; gap: 8px; margin-top: 14px; }.command-item { display: grid; gap: 5px; width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: #0c1524; color: var(--text); text-align: left; }.command-item strong { color: var(--accent); }.command-item span, .empty-commands { color: var(--muted); font-size: 12px; }.empty-commands { margin: 14px 0 0; }

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 18px;
}

.empty-notifications {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.notification-list { display: grid; gap: 8px; margin-top: 14px; }
.notification-item { padding: 10px; border: 1px solid var(--border); border-radius: 9px; background: #0c1524; }
.notification-item.is-unread { border-color: var(--accent); }
.notification-item strong, .notification-item p, .notification-item small { display: block; }
.notification-item p { margin: 5px 0; color: var(--muted); font-size: 13px; }
.notification-item small { color: var(--muted); font-size: 11px; }
