:root {
  color-scheme: light;
  --orange: #FF6B00;
  --orange-dark: #D95500;
  --ink: #23231f;
  --muted: #74706a;
  --line: #eadfd2;
  --bg: #fffaf5;
  --card: #ffffff;
  --soft: #fff1e5;
  --danger: #b42318;
  --success: #157347;
  --shadow: 0 10px 28px rgba(84, 45, 0, .09);
  font-family: Inter, ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.app-shell { min-height: 100vh; padding-bottom: 92px; }
.topbar {
  position: sticky; top: 0; z-index: 20; min-height: 66px; padding: 10px clamp(14px, 4vw, 36px);
  display: flex; align-items: center; gap: 18px; background: rgba(255,250,245,.94); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.brand { color: var(--ink); text-decoration: none; font-size: 1.45rem; font-weight: 900; letter-spacing: -.04em; white-space: nowrap; }
.brand-team { color: var(--orange); }
.company-name { font-weight: 750; color: #5d4632; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.install-button, .primary { border: 0; border-radius: 999px; background: var(--orange); color: white; font-weight: 800; padding: 11px 16px; box-shadow: 0 5px 14px rgba(255,107,0,.25); }
.install-button:hover, .primary:hover { background: var(--orange-dark); }
.ghost-button, .secondary { border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 999px; padding: 10px 14px; font-weight: 750; }
.profile-chip { background: var(--soft); border: 1px solid #ffd7b8; padding: 8px 11px; border-radius: 999px; font-weight: 750; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main-content { width: min(1180px, 100%); margin: 0 auto; padding: 26px clamp(14px, 4vw, 36px); }
.auth-card { max-width: 560px; margin: 5vh auto; background: var(--card); border: 1px solid var(--line); border-radius: 28px; padding: clamp(22px, 5vw, 42px); box-shadow: var(--shadow); }
.eyebrow { color: var(--orange); font-weight: 900; text-transform: uppercase; letter-spacing: .1em; font-size: .76rem; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); line-height: .98; letter-spacing: -.045em; margin: 8px 0 14px; }
h2 { letter-spacing: -.025em; margin: 0 0 14px; }
h3 { margin: 0 0 9px; }
.muted, .hint { color: var(--muted); }
.hint, .optional { font-size: .86rem; }
.stack { display: grid; gap: 13px; margin-top: 18px; }
label { display: grid; gap: 6px; font-weight: 720; }
input, select, textarea { width: 100%; border: 1px solid #dccbb8; border-radius: 14px; background: #fff; padding: 11px 12px; color: var(--ink); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,107,0,.17); }
textarea { min-height: 86px; resize: vertical; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: #f6eadf; border-radius: 999px; padding: 4px; margin: 22px 0 6px; }
.segmented button { border: 0; border-radius: 999px; padding: 10px; background: transparent; font-weight: 800; }
.segmented button.active { background: white; box-shadow: 0 3px 10px rgba(0,0,0,.08); }
.alert { margin-top: 16px; background: #fff0ee; color: var(--danger); border: 1px solid #ffc9c2; padding: 12px; border-radius: 14px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head p { margin: 0; color: var(--muted); }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 18px; box-shadow: 0 4px 16px rgba(84,45,0,.05); }
.metric { font-size: 2rem; font-weight: 900; letter-spacing: -.04em; }
.metric-label { color: var(--muted); font-weight: 700; }
.section { margin-top: 24px; }
.list { display: grid; gap: 10px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.item { background: white; border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.item p { margin: 5px 0; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; background: var(--soft); color: #8a3b00; font-size: .78rem; font-weight: 800; }
.badge.gray { background: #f2f2f2; color: #666; }
.badge.red { background: #fff0ee; color: var(--danger); }
.badge.green { background: #eaf7ef; color: var(--success); }
.tabs, .chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.tabs button, .chips button { border: 1px solid var(--line); background: white; border-radius: 999px; padding: 9px 13px; font-weight: 800; }
.tabs button.active, .chips button.active { background: var(--orange); border-color: var(--orange); color: white; }
.location-row { width: 100%; text-align: left; display: flex; justify-content: space-between; align-items: center; background: white; border: 1px solid var(--line); padding: 17px; border-radius: 19px; font-weight: 850; }
.location-row small { display: block; color: var(--muted); font-weight: 600; margin-top: 4px; }
.table-wrap { overflow-x: auto; background: white; border: 1px solid var(--line); border-radius: 18px; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid #f1e7dc; }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.form-card { margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; }
.form-grid .wide { grid-column: span 2; }
.checkline { display: flex; grid-template-columns: none; align-items: center; gap: 9px; font-weight: 700; }
.checkline input { width: auto; }
.install-card { display: flex; justify-content: space-between; align-items: center; gap: 18px; background: #2b211b; color: white; padding: 18px; border-radius: 22px; margin-bottom: 18px; }
.install-card p { color: #eadfd4; margin: 5px 0 0; }
.bottom-nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px; z-index: 30; width: min(1060px, calc(100% - 16px)); display: grid; grid-template-columns: repeat(10, 1fr); background: rgba(255,255,255,.96); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 24px; padding: 7px; }
.bottom-nav button { border: 0; background: transparent; border-radius: 17px; padding: 8px 3px; display: grid; place-items: center; gap: 2px; font-size: 1.05rem; color: var(--ink); }
.bottom-nav button span { font-size: .66rem; font-weight: 800; }
.bottom-nav button.active { background: var(--soft); color: var(--orange-dark); }
.toast { position: fixed; right: 18px; bottom: 104px; z-index: 40; background: #23231f; color: white; padding: 12px 15px; border-radius: 14px; box-shadow: var(--shadow); max-width: min(420px, calc(100vw - 36px)); }
dialog { border: 0; border-radius: 24px; padding: 0; width: min(680px, calc(100vw - 28px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(35,35,31,.45); }
.dialog-card { padding: 24px; display: grid; gap: 15px; }
.device-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.device-tabs section { background: var(--soft); border-radius: 16px; padding: 13px; }
.message { max-width: 78%; background: #f7f2ec; border-radius: 16px; padding: 10px 12px; }
.message.mine { margin-left: auto; background: var(--soft); }
.chat-box { display: grid; gap: 9px; max-height: 480px; overflow: auto; padding: 6px; }
details.inline-edit { margin-top: 10px; }
details.inline-edit summary { color: var(--orange-dark); font-weight: 800; cursor: pointer; }
pre.code { white-space: pre-wrap; word-break: break-all; background: #23231f; color: white; padding: 10px; border-radius: 12px; }
@media (max-width: 760px) {
  .company-name { display: none; }
  .profile-chip { display: none; }
  .grid.two, .grid.three, .grid.four, .form-grid, .device-tabs { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .bottom-nav { display: flex; overflow-x: auto; border-radius: 20px; }
  .bottom-nav button { min-width: 76px; flex: 0 0 auto; }
  .install-button { padding: 9px 11px; font-size: .88rem; }
  .main-content { padding-top: 18px; }
  .message { max-width: 92%; }
}
@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --bg: #171512; --card: #23211d; --ink: #f6f1ea; --muted: #b7ada2; --line: #453b32; --soft: #3a2718; }
  .topbar { background: rgba(23,21,18,.94); }
  input, select, textarea, .item, .location-row, .table-wrap, .tabs button, .chips button, .ghost-button, .secondary { background: #23211d; color: var(--ink); }
  .bottom-nav { background: rgba(35,33,29,.97); }
  th, td { border-color: #3d352e; }
}
