:root {
  color-scheme: dark;
  font-family: Inter, system-ui, sans-serif;
  background: #07111f;
  color: #e7eef8;
  --app-width: 430px;
  --surface: #0d1b2d;
  --border: #29405d;
  --accent: #25a9e0;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(circle at 50% 0, #122840 0, #07111f 48%, #03070d 100%);
}
.mobile-app {
  width: 100%;
  max-width: var(--app-width);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(22px + env(safe-area-inset-top, 0px)) 18px calc(88px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, #081522 0%, #050c14 100%);
}
.app-header { position: relative; padding: 8px 4px 4px; }
.utility-bar { position: sticky; z-index: 5; top: env(safe-area-inset-top, 0px); display: flex; align-items: center; justify-content: space-between; min-height: 24px; margin: -4px 0 16px; }
.environment { margin: 0; color: #79d4ff; font-size: .68rem; font-weight: 850; letter-spacing: .15em; }
.screen-meta { display: inline-flex; align-items: center; gap: 5px; margin: 0; padding: 4px 8px; border: 1px solid #29405d; border-radius: 999px; background: #07111fee; color: #a9bdd3; font: 750 .68rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .02em; }
#screen-code { color: #7dd3fc; font-weight: 900; }
h1 { margin: 0; font-size: clamp(2rem, 10vw, 2.7rem); line-height: .95; letter-spacing: -.045em; }
.product-name { margin: 7px 0 0; color: var(--accent); font-size: 1rem; font-weight: 850; letter-spacing: .18em; }
.intro { max-width: 19rem; margin: 18px 0 0; color: #9db0c6; font-size: .95rem; line-height: 1.5; }
.context-bar { display: grid; grid-template-columns: .8fr 1.15fr 1.15fr; gap: 7px; margin-top: 18px; padding: 9px; border: 1px solid #1f3045; border-radius: 12px; background: #07111fa8; }
.context-bar span { min-width: 0; }
.context-bar small, .context-bar strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-bar small { margin-bottom: 3px; color: #6f849b; font-size: .57rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.context-bar strong { color: #d9e5f2; font-size: .68rem; }
section { margin-top: 26px; padding: 20px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: 0 18px 45px #0005; }
h2 { margin: 0 0 20px; font-size: 1.25rem; }
form { display: grid; gap: 1rem; }
label { display: grid; gap: .4rem; color: #b9c8db; }
input, button { width: 100%; min-height: 50px; padding: 0 14px; border: 1px solid #3b5577; border-radius: 11px; font: inherit; font-size: 16px; }
input[type="checkbox"] { width: 22px; min-height: 22px; padding: 0; accent-color: var(--accent); }
input { background: #07111f; color: #e7eef8; outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #25a9e026; }
button { margin-top: .5rem; cursor: pointer; background: linear-gradient(135deg, #1685ba, #1f6dd1); color: white; font-weight: 800; }
button:active { transform: translateY(1px); }
output { display: block; min-height: 1.5rem; margin-top: .75rem; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.title-row h2 { margin: 0; }
.compact-button { width: auto; min-height: 38px; margin: 0; padding: 0 12px; font-size: .78rem; }
.secondary-button { margin-top: 14px; background: #15283e; }
.action-panel { margin-top: 18px; padding: 14px; border: 1px solid #29405d; border-radius: 12px; background: #091522; }
.action-panel summary { cursor: pointer; color: #7dd3fc; font-weight: 800; }
.action-panel form { margin-top: 16px; }
fieldset { display: grid; gap: 12px; margin: 0; padding: 14px; border: 1px solid #29405d; border-radius: 11px; }
fieldset legend { padding: 0 6px; color: #9db0c6; font-size: .8rem; }
fieldset > label:has(input[type="checkbox"]) { display: flex; grid-template-columns: auto 1fr; align-items: center; }
fieldset [data-initial-user] { display: grid; gap: 12px; padding: 12px; border-left: 2px solid #245b7b; }
.record-list { display: grid; gap: 9px; margin-top: 12px; }
.record-button { margin: 0; padding: 12px; min-height: 64px; text-align: left; background: #101f33; }
.record-button strong, .record-button span { display: block; }
.record-button span { margin-top: 5px; color: #9db0c6; font-size: .75rem; }
.role-options { display: grid; gap: 9px; }
.role-options label { display: flex; align-items: center; gap: 9px; }
.danger-actions { display: grid; gap: 9px; margin-top: 18px; }
.danger-button { background: linear-gradient(135deg, #9f2727, #701d2c); }
.screen-help { margin: -6px 0 18px; color: #9db0c6; font-size: .86rem; line-height: 1.45; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.module-card { min-height: 112px; margin: 0; padding: 14px; text-align: left; background: #101f33; }
.module-card strong, .module-card span { display: block; }
.module-card strong { color: #e7eef8; font-size: .95rem; }
.module-card span { margin-top: 8px; color: #91a7bf; font-size: .72rem; line-height: 1.35; }
.empty-state { margin: 0; padding: 18px; border: 1px dashed #3b5577; border-radius: 12px; color: #9db0c6; font-size: .88rem; line-height: 1.5; }
.detail-list { display: grid; grid-template-columns: minmax(90px, .8fr) minmax(0, 1.2fr); margin: 0; }
.detail-list dt, .detail-list dd { margin: 0; padding: 11px 6px; border-bottom: 1px solid #233750; overflow-wrap: anywhere; }
.detail-list dt { color: #8198b1; font-size: .75rem; }
.detail-list dd { color: #e7eef8; font-size: .86rem; font-weight: 700; }
.bottom-nav { position: fixed; z-index: 10; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(4, 1fr); width: min(100%, var(--app-width)); margin: 0 auto; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid #29405d; background: #07111ff2; backdrop-filter: blur(14px); }
.bottom-nav button { min-height: 42px; margin: 0; padding: 0 4px; border-color: transparent; background: transparent; color: #8fa5bd; font-size: .68rem; }
.bottom-nav button.is-active { border-color: #2e6082; background: #12304a; color: #7dd3fc; }
footer { padding: 28px 4px 4px; color: #63778e; font-size: .72rem; text-align: center; }
[hidden] { display: none !important; }

@media (min-width: 520px) {
  body { padding: 20px 0; }
  .mobile-app { min-height: calc(100dvh - 40px); border: 1px solid #28364a; border-radius: 29px; box-shadow: 0 28px 80px #0009; }
}

@media (max-width: 350px) {
  .mobile-app { padding-right: 13px; padding-left: 13px; }
  section { padding: 16px; }
  .context-bar { gap: 4px; padding: 8px 6px; }
  .context-bar strong { font-size: .62rem; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
