:root {
  color-scheme: light;
  --bg: #f8f1ea;
  --panel: #ffffff;
  --panel-soft: #fff8f1;
  --text: #351714;
  --muted: #7d6a63;
  --line: #eadbd0;
  --brand: #a91f1f;
  --brand-dark: #621414;
  --brand-2: #d9a441;
  --danger: #b72d2d;
  --warning: #9f6610;
  --shadow: 0 18px 44px rgba(92, 32, 22, 0.13);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(120deg, rgba(169, 31, 31, 0.1), rgba(217, 164, 65, 0.14)),
    var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  background: #40110f;
  color: #fff6ea;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 12px;
  background: #ff272d;
  box-shadow: 0 10px 24px rgba(169, 31, 31, 0.3);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand h1 {
  font-size: 24px;
}

.brand p {
  margin-top: 4px;
  color: #e3c7b1;
  font-size: 13px;
}

.store-card,
.side-note {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.store-card label,
.side-note strong,
.side-note span,
.side-note a {
  display: block;
}

.store-card label {
  margin-bottom: 8px;
  color: #ead0bc;
  font-size: 13px;
}

.store-card select {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #5a1714;
  color: #fff;
  padding: 0 12px;
}

.store-meta {
  margin-top: 10px;
  color: #ead0bc;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
}

.login-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.side-btn {
  min-height: 34px;
  border: 1px solid rgba(217, 164, 65, 0.42);
  border-radius: 8px;
  background: rgba(217, 164, 65, 0.12);
  color: #ffe4a3;
  padding: 0 8px;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: transparent;
  color: #f3dfcf;
  text-align: left;
  padding: 0 14px;
}

.nav-tab.active {
  border-color: rgba(215, 168, 79, 0.55);
  background: rgba(217, 164, 65, 0.18);
  color: #fff;
}

.side-note {
  margin-top: auto;
}

.side-note strong {
  margin-bottom: 8px;
}

.side-note span {
  color: #ead0bc;
  font-size: 13px;
  line-height: 1.6;
}

.side-link {
  margin-top: 12px;
  color: #f3c96d;
  font-size: 13px;
  text-decoration: none;
}

.main {
  padding: 28px;
  overflow: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h2,
.panel h3 {
  margin: 0;
}

.topbar h2 {
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.2;
  max-width: 820px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.top-actions,
.report-actions,
.inline-actions,
.dialog-actions,
.check-stage-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.icon-only,
.segment {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  white-space: nowrap;
}

.primary-btn {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  box-shadow: 0 10px 20px rgba(169, 31, 31, 0.22);
}

.ghost-btn,
.icon-btn {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.icon-only {
  width: 36px;
  min-height: 36px;
  padding: 0;
  background: #f4f7f5;
  color: var(--muted);
  border-color: var(--line);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

body.is-home {
  background:
    linear-gradient(180deg, #fffaf3 0%, #f8f1ea 42%, #fffaf5 100%);
}

body.is-home .app-shell {
  display: block;
}

body.is-home .sidebar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(64, 17, 15, 0.96);
  box-shadow: 0 12px 32px rgba(64, 17, 15, 0.18);
}

body.is-home .store-card,
body.is-home .side-note {
  display: none;
}

body.is-home .nav-tabs {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

body.is-home .nav-tab {
  width: auto;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  background: transparent;
  color: #f3d7c4;
  font-size: 13px;
}

body.is-home .nav-tab.active {
  background: rgba(217, 164, 65, 0.18);
  color: #ffe7aa;
}

body.is-home .nav-tab:nth-child(n+4):not([data-view="checks"]) {
  display: none;
}

body.is-home .main {
  padding: 0;
  overflow: visible;
}

body.is-home .topbar,
body.is-home .stats-grid {
  display: none;
}

body.is-home #homeView {
  display: block;
}

body.is-home .view:not(#homeView).active {
  display: block;
}

.promo-hero {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 0.82fr);
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 5vw, 72px);
  min-height: min(760px, calc(100vh - 76px));
  margin: 0;
  padding: clamp(34px, 6vw, 78px) clamp(18px, 5vw, 72px) clamp(28px, 5vw, 58px);
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(115deg, rgba(64, 17, 15, 0.98) 0%, rgba(98, 20, 20, 0.95) 46%, rgba(169, 31, 31, 0.82) 100%),
    #621414;
  color: #fff8ec;
  overflow: hidden;
}

.promo-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  max-width: 620px;
}

.promo-copy h3 {
  margin: 0;
  max-width: 12em;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 1.04;
  font-weight: 900;
  word-break: keep-all;
  overflow-wrap: normal;
  text-wrap: balance;
}

.hero-title span {
  display: block;
  white-space: nowrap;
}

.promo-copy p {
  margin: 0;
  max-width: 560px;
  color: #f3d7c4;
  font-size: 17px;
  line-height: 1.9;
}

.promo-copy .eyebrow {
  color: #f3c96d;
}

.promo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.promo-hero .primary-btn,
.promo-hero .ghost-btn {
  min-height: 48px;
  padding-inline: 20px;
}

.promo-hero .ghost-btn {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
  color: #fff8ec;
}

.promo-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.promo-badges span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(243, 201, 109, 0.34);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffe3a1;
  font-size: 12px;
  font-weight: 800;
}

.phone-showcase {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.phone-frame {
  position: relative;
  width: min(390px, 100%);
  padding: 18px 14px 16px;
  border: 1px solid rgba(255, 232, 170, 0.36);
  border-radius: 38px;
  background:
    linear-gradient(145deg, #241211, #090606 44%, #2a1512),
    #100807;
  box-shadow:
    0 34px 84px rgba(25, 5, 5, 0.5),
    inset 0 0 0 2px rgba(255, 255, 255, 0.06);
}

.phone-frame::before {
  content: "";
  position: absolute;
  inset: 8px;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
}

.phone-speaker {
  position: relative;
  z-index: 2;
  width: 72px;
  height: 6px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: #3a2a28;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.12);
}

.promo-device {
  position: relative;
  z-index: 1;
  min-width: 0;
  max-width: none;
  padding: 16px;
  border: 1px solid rgba(243, 201, 109, 0.35);
  border-radius: 24px;
  background: #fffaf5;
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  overflow: hidden;
}

.promo-device::before {
  content: "";
  position: absolute;
  inset: 8px;
  pointer-events: none;
  border: 1px solid rgba(217, 164, 65, 0.22);
  border-radius: 18px;
}

.device-topline,
.device-metrics,
.device-feed {
  display: grid;
  gap: 12px;
}

.device-topline {
  grid-template-columns: 1fr auto;
  align-items: center;
  position: relative;
  z-index: 1;
  padding: 6px 4px 12px;
  border-bottom: 1px solid #f0dfd2;
}

.device-topline span,
.device-topline em {
  grid-column: 1 / -1;
}

.device-topline span {
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}

.device-topline strong {
  color: var(--brand-dark);
  font-size: 22px;
  line-height: 1.25;
}

.device-topline em {
  color: #9f6610;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.device-metrics {
  position: relative;
  z-index: 1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.device-metrics div {
  min-height: 78px;
  padding: 12px;
  border: 1px solid rgba(217, 164, 65, 0.22);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff9ed, #fff);
}

.device-metrics span,
.feed-tag {
  display: block;
  color: #9f6610;
  font-size: 12px;
  font-weight: 800;
}

.device-metrics strong {
  display: block;
  margin-top: 8px;
  color: var(--brand-dark);
  font-size: 26px;
  line-height: 1;
}

.device-feed {
  position: relative;
  z-index: 1;
  margin-top: 12px;
}

.device-feed article {
  padding: 12px 14px;
  border: 1px solid #f0dfd2;
  border-radius: 14px;
  background: #ffffff;
}

.device-feed p {
  margin: 7px 0 0;
  color: #5a453f;
  line-height: 1.6;
}

.device-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0dfd2;
}

.device-footer span {
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
}

.device-footer .ghost-btn {
  min-height: 36px;
  padding: 8px 12px;
}

.promo-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: center;
}

.promo-board div {
  min-height: 150px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.promo-board span {
  color: #f3c96d;
  font-size: 12px;
  font-weight: 800;
}

.promo-board strong {
  display: block;
  margin-top: 10px;
  font-size: 20px;
}

.promo-board p {
  margin: 8px 0 0;
  color: #f3d7c4;
  line-height: 1.6;
}

.promo-strip,
.compact-tags {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  background: #fffaf5;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.promo-strip span,
.compact-tags span {
  min-height: 64px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: #5a453f;
  font-size: 13px;
  font-weight: 700;
}

.promo-strip span:first-child,
.compact-tags span:first-child {
  border-left: 0;
}

.promo-strip strong,
.compact-tags strong {
  display: block;
  color: var(--brand-dark);
  font-size: 17px;
  font-weight: 800;
}

.home-section {
  margin: 0;
  padding: clamp(42px, 6vw, 76px) clamp(18px, 5vw, 72px);
  border: 0;
  border-radius: 0;
  background: #fffaf5;
  box-shadow: none;
}

.home-section-soft {
  background: #f8f1ea;
}

.home-compact-page {
  min-height: calc(100vh - 74px);
  display: grid;
  align-content: center;
  gap: 18px;
  background: #fffaf5;
}

.home-section-head {
  display: grid;
  grid-template-columns: minmax(160px, 0.28fr) minmax(320px, 0.72fr);
  gap: 28px;
  align-items: end;
  max-width: 1180px;
  margin: 0 auto 22px;
}

.home-section-head h3 {
  margin: 0;
  color: var(--brand-dark);
  font-size: clamp(28px, 3.2vw, 42px);
  line-height: 1.25;
}

.home-section-head .eyebrow {
  margin: 0;
}

.home-feature-grid,
.usage-flow,
.recharge-grid,
.compact-grid {
  display: grid;
  gap: 12px;
  max-width: 1180px;
  margin: 0 auto;
}

.compact-tags {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.compact-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  align-items: stretch;
}

.compact-panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.compact-panel .eyebrow {
  margin: 0 0 12px;
}

.compact-panel h4 {
  margin: 0;
  color: var(--brand-dark);
  font-size: 26px;
  line-height: 1.2;
}

.compact-panel > p:not(.eyebrow) {
  margin: 12px 0 0;
  color: #5a453f;
  line-height: 1.7;
}

.compact-panel ul {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding-left: 18px;
  color: #5a453f;
  line-height: 1.55;
}

.recharge-panel-home {
  background: #fff6e3;
}

.recharge-panel-home .primary-btn {
  width: 100%;
  margin-top: 18px;
}

.home-feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-card,
.flow-step,
.recharge-method {
  min-width: 0;
  min-height: 190px;
  padding: 22px;
  border: 1px solid #eadbd0;
  border-radius: 8px;
  background: #ffffff;
}

.home-card span,
.flow-step span,
.recharge-method > span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #fff1d1;
  color: #9f6610;
  font-size: 12px;
  font-weight: 900;
}

.home-card strong,
.flow-step strong,
.recharge-method strong {
  display: block;
  margin-top: 16px;
  color: var(--brand-dark);
  font-size: 21px;
}

.home-card p,
.flow-step p,
.recharge-method p {
  margin: 9px 0 0;
  color: #5a453f;
  line-height: 1.75;
}

.usage-flow {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  counter-reset: flow;
}

.flow-step {
  position: relative;
  background: #fff;
  min-height: 142px;
}

.recharge-section {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 247, 229, 0.94)),
    #ffffff;
}

.recharge-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.recharge-method {
  min-height: 210px;
}

.recharge-method .primary-btn {
  width: 100%;
  margin-top: 14px;
}

.recharge-method.is-highlight {
  border-color: rgba(169, 31, 31, 0.25);
  background: #fff6e3;
}

.stat {
  min-height: 102px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(92, 32, 22, 0.08);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 0.8fr);
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel h3 {
  font-size: 20px;
}

.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.quick-record,
.template-quick-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-record button,
.template-quick-add button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(217, 164, 65, 0.45);
  border-radius: 999px;
  background: #fff8f1;
  color: #8f1d1d;
  font-size: 13px;
  font-weight: 800;
}

.quick-record button:focus-visible,
.template-quick-add button:focus-visible {
  outline: 3px solid rgba(217, 164, 65, 0.35);
  outline-offset: 2px;
}

.photo-hint {
  margin-top: -4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.checkbox-line input {
  width: 18px;
  min-width: 18px;
  height: 18px;
}

.restore-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.restore-box button,
.restore-box p {
  grid-column: 1 / -1;
}

.restore-box p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 112px;
  line-height: 1.6;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(169, 31, 31, 0.8);
  box-shadow: 0 0 0 3px rgba(169, 31, 31, 0.12);
}

.list {
  display: grid;
  gap: 12px;
}

.empty {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  text-align: center;
}

.upgrade-box {
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid rgba(169, 31, 31, 0.22);
  border-radius: 8px;
  background: #fff8f1;
}

.upgrade-box h3,
.upgrade-box p {
  margin: 0;
}

.upgrade-box p {
  color: var(--muted);
  line-height: 1.7;
}

.log-item,
.task-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.item-head,
.item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-title {
  margin: 0;
  font-size: 16px;
}

.item-content {
  margin: 0;
  color: #5a453f;
  line-height: 1.65;
}

.image-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.image-preview img,
.thumbs img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f7f5;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(5, 56px);
  gap: 8px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #fff1eb;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.pill.gold {
  background: #fbf3df;
  color: #8f5f0d;
}

.pill.red {
  background: #faeaea;
  color: var(--danger);
}

.task-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.handover-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.check-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.check-stage-tabs {
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.check-list {
  display: grid;
  gap: 12px;
}

.check-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.check-item.is-done {
  border-color: rgba(217, 164, 65, 0.55);
  background: #fffaf0;
}

.check-item.is-abnormal {
  border-color: rgba(183, 45, 45, 0.55);
  background: #fff5f3;
}

.handover-metric {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.handover-metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.handover-metric strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.alert-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-item {
  padding: 12px 14px;
  border: 1px solid #efc4b8;
  border-radius: 8px;
  background: #fff0ea;
  color: #8d1d1d;
  font-weight: 700;
}

.handover-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.handover-grid h4 {
  margin: 0 0 10px;
  font-size: 16px;
}

.compact-list {
  display: grid;
  gap: 10px;
}

.compact-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.compact-item strong {
  display: block;
  margin-bottom: 6px;
}

.compact-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.audit-list {
  display: grid;
  gap: 10px;
}

.audit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf6;
}

.audit-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.audit-item .pill {
  flex: 0 0 auto;
}

.settings-members-panel {
  box-shadow: none;
}

.member-list {
  display: grid;
  gap: 10px;
}

.member-item {
  display: grid;
  grid-template-columns: minmax(160px, 0.6fr) minmax(360px, 1.4fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.member-item.is-disabled {
  background: #f9f3ed;
  opacity: 0.78;
}

.member-item strong {
  display: block;
  margin-bottom: 4px;
}

.member-actions {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(96px, 0.6fr) auto auto;
  gap: 8px;
  align-items: center;
}

.settings-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.price-card {
  display: grid;
  gap: 14px;
  min-height: 250px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.price-card.is-current {
  border-color: rgba(217, 164, 65, 0.75);
  background: #fffaf0;
}

.price-card h4 {
  margin: 12px 0 4px;
  font-size: 20px;
}

.price-card strong {
  display: block;
  font-size: 30px;
  color: var(--brand);
}

.price-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.price-card ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: #5a453f;
}

.billing-limit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.limit-card {
  min-height: 96px;
  padding: 12px;
  border: 1px solid #eadbd0;
  border-radius: 8px;
  background: #fffaf5;
}

.limit-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.limit-card strong {
  display: block;
  margin-top: 6px;
  color: var(--brand);
  font-size: 24px;
  line-height: 1.1;
}

.limit-card p {
  margin: 8px 0 0;
  color: #5a453f;
  font-size: 12px;
  line-height: 1.45;
}

.limit-card.is-warning {
  border-color: rgba(217, 164, 65, 0.7);
  background: #fff6dc;
}

.limit-card.is-danger,
.limit-card.is-expired {
  border-color: rgba(143, 29, 29, 0.45);
  background: #fff0ed;
}

.fine-print {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.template-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.template-items-list {
  display: grid;
  gap: 10px;
}

.template-item {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(460px, 1.3fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.template-item.is-disabled {
  background: #f9f3ed;
  opacity: 0.78;
}

.template-item strong {
  display: block;
  margin-bottom: 4px;
}

.template-actions {
  display: grid;
  grid-template-columns: 92px 92px minmax(180px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
}

.compact-check {
  min-height: 40px;
  justify-content: center;
}

.mini-preview {
  min-height: 170px;
  max-height: 280px;
  overflow: auto;
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8f1;
  color: #5a453f;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.task-item {
  min-height: 190px;
}

.task-filters {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-select {
  min-width: 170px;
}

.filter-select select {
  min-height: 40px;
  padding: 0 12px;
}

.task-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 10px;
  align-items: center;
}

.task-result,
.comments {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.task-result strong,
.comment-item strong {
  color: var(--brand-dark);
}

.task-result p,
.comment-item p {
  margin: 4px 0 0;
  color: #5a453f;
  line-height: 1.55;
}

.comment-item {
  display: grid;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.comment-item:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segment {
  background: #f5f8f6;
  border-color: var(--line);
  color: var(--muted);
}

.segment.active {
  background: #7f1818;
  color: #fff;
  border-color: #7f1818;
}

.mail-status {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #f5f8f6;
  color: var(--muted);
  line-height: 1.5;
}

.template-summary-line {
  margin-bottom: 10px;
}

.template-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.template-summary-chip {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #eadbd0;
  border-radius: 8px;
  background: #fff8f1;
  color: #5a453f;
  font-size: 12px;
}

.template-summary-chip strong {
  display: block;
  color: #8f1d1d;
  font-size: 13px;
}

.report-preview {
  width: 100%;
  min-height: 620px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: auto;
}

.report-preview > * {
  margin: 0;
}

.dialog {
  width: min(560px, calc(100vw - 28px));
  border: none;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.dialog::backdrop {
  background: rgba(54, 15, 12, 0.48);
}

.dialog-card {
  display: grid;
  gap: 14px;
  padding: 20px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(380px, calc(100vw - 48px));
  padding: 13px 16px;
  border-radius: 8px;
  background: #40110f;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.support-bubble {
  position: fixed;
  right: 24px;
  bottom: 92px;
  z-index: 18;
  display: grid;
  justify-items: end;
  gap: 10px;
  touch-action: none;
}

.support-toggle {
  width: 58px;
  height: 58px;
  border: 1px solid rgba(217, 164, 65, 0.72);
  border-radius: 999px;
  background: linear-gradient(135deg, #9f1f1b, #5f1110);
  color: #ffe8aa;
  box-shadow: 0 14px 32px rgba(95, 17, 16, 0.22);
  cursor: grab;
  font-weight: 800;
  letter-spacing: 0;
}

.support-toggle:active {
  cursor: grabbing;
}

.support-panel {
  width: min(280px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid #eadbd0;
  border-radius: 8px;
  background: #fffaf5;
  color: #351714;
  box-shadow: var(--shadow);
}

.support-panel strong,
.support-panel span {
  display: block;
}

.support-panel strong {
  margin-bottom: 8px;
}

.support-panel span {
  margin-top: 6px;
  color: #5a453f;
  font-size: 13px;
  line-height: 1.5;
}

.support-panel .ghost-btn {
  width: 100%;
  margin-top: 12px;
}

@media (max-width: 980px) {
  body.is-home .sidebar {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  body.is-home .nav-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: 2px;
  }

  body.is-home .nav-tab {
    flex: 0 0 auto;
  }

  body.is-home .promo-hero {
    grid-template-columns: 1fr;
    gap: 20px;
    min-height: auto;
    padding: 36px 28px 30px;
  }

  body.is-home .promo-copy {
    gap: 14px;
    max-width: 680px;
  }

  body.is-home .promo-copy h3 {
    max-width: 9.5em;
    font-size: clamp(40px, 8vw, 56px);
  }

  body.is-home .hero-title {
    max-width: 12em;
  }

  body.is-home .promo-copy p {
    max-width: 640px;
    font-size: 16px;
    line-height: 1.7;
  }

  body.is-home .promo-device {
    max-width: none;
    padding: 16px;
    border-radius: 16px;
  }

  body.is-home .phone-frame {
    width: min(380px, 100%);
    padding: 15px 12px 14px;
    border-radius: 32px;
  }

  body.is-home .phone-frame::before {
    border-radius: 25px;
  }

  body.is-home .phone-speaker {
    margin-bottom: 10px;
  }

  body.is-home .device-topline {
    padding-bottom: 12px;
  }

  body.is-home .device-topline strong {
    font-size: 21px;
  }

  body.is-home .device-metrics {
    gap: 10px;
    margin-top: 12px;
  }

  body.is-home .device-metrics div {
    min-height: 74px;
    padding: 11px;
  }

  body.is-home .device-metrics strong {
    font-size: 23px;
  }

  body.is-home .device-feed {
    margin-top: 12px;
  }

  body.is-home .device-feed article {
    padding: 11px 12px;
  }

  body.is-home .device-feed article:nth-child(n+2) {
    display: none;
  }

  body.is-home .device-footer {
    margin-top: 12px;
    padding-top: 12px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 18px;
  }

  .nav-tabs {
    grid-template-columns: repeat(3, 1fr);
  }

  .nav-tab {
    text-align: center;
  }

  .side-note {
    display: none;
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions,
  .report-actions,
  .task-filters {
    width: 100%;
  }

  .top-actions > *,
  .report-actions > *,
  .task-filters > * {
    flex: 1;
  }

  .stats-grid,
  .promo-hero,
  .promo-board,
  .promo-strip,
  .compact-tags,
  .compact-grid,
  .home-section-head,
  .home-feature-grid,
  .usage-flow,
  .recharge-grid,
  .workspace-grid,
  .settings-grid,
  .pricing-grid,
  .billing-limit-grid,
  .task-board,
  .handover-summary,
  .check-summary,
  .handover-grid,
  .member-item,
  .template-item,
  .template-picker {
    grid-template-columns: 1fr;
  }

  .member-actions,
  .template-actions {
    grid-template-columns: 1fr 1fr;
  }

  .restore-box {
    grid-template-columns: 1fr;
  }

  .promo-device {
    width: 100%;
  }

}

@media (max-width: 560px) {
  body.is-home .sidebar {
    gap: 8px;
    padding: 10px 14px;
  }

  body.is-home .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }

  body.is-home .brand h1 {
    font-size: 20px;
  }

  body.is-home .brand p {
    font-size: 12px;
  }

  body.is-home .nav-tabs {
    gap: 6px;
    overflow-x: hidden;
  }

  body.is-home .nav-tab {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 12px;
  }

  body.is-home .promo-hero {
    gap: 8px;
    padding: 16px 14px 16px;
  }

  body.is-home .promo-copy {
    gap: 8px;
  }

  body.is-home .promo-copy h3 {
    max-width: none;
    font-size: 27px;
    line-height: 1.08;
  }

  body.is-home .hero-title span {
    white-space: nowrap;
  }

  body.is-home .promo-copy p {
    font-size: 14px;
    line-height: 1.48;
  }

  body.is-home .promo-hero .primary-btn,
  body.is-home .promo-hero .ghost-btn {
    min-height: 38px;
    padding-inline: 12px;
  }

  body.is-home .promo-badges span {
    min-height: 26px;
    padding: 4px 8px;
  }

  body.is-home .phone-frame {
    width: min(318px, 100%);
    padding: 9px 8px;
    border-radius: 26px;
  }

  body.is-home .phone-speaker {
    width: 52px;
    height: 4px;
    margin-bottom: 7px;
  }

  body.is-home .promo-device {
    padding: 10px;
    border-radius: 18px;
  }

  body.is-home .device-topline {
    gap: 4px;
    padding: 4px 3px 7px;
  }

  body.is-home .device-topline span,
  body.is-home .device-topline em,
  body.is-home .device-metrics span,
  body.is-home .feed-tag {
    font-size: 11px;
  }

  body.is-home .device-topline strong {
    font-size: 17px;
  }

  body.is-home .device-metrics {
    gap: 6px;
    margin-top: 7px;
  }

  body.is-home .device-metrics div {
    min-height: 54px;
    padding: 7px;
    border-radius: 10px;
  }

  body.is-home .device-metrics strong {
    margin-top: 5px;
    font-size: 18px;
  }

  body.is-home .device-feed {
    margin-top: 7px;
  }

  body.is-home .device-feed article {
    padding: 8px;
    border-radius: 10px;
  }

  body.is-home .device-feed p {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.35;
  }

  body.is-home .device-footer {
    gap: 6px;
    margin-top: 7px;
    padding-top: 7px;
  }

  body.is-home .device-footer span {
    font-size: 12px;
  }

  body.is-home .device-footer .ghost-btn {
    min-height: 32px;
    padding: 6px 10px;
  }

  body.is-home .home-compact-page {
    gap: 10px;
    padding: 22px 14px;
  }

  body.is-home .home-section-head {
    gap: 8px;
    margin-bottom: 4px;
  }

  body.is-home .home-section-head h3 {
    font-size: 22px;
  }

  body.is-home .compact-tags {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  body.is-home .compact-tags span,
  body.is-home .compact-tags span:first-child {
    min-height: 48px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    font-size: 11px;
  }

  body.is-home .compact-tags strong {
    font-size: 13px;
  }

  body.is-home .compact-grid,
  body.is-home .usage-flow {
    gap: 8px;
    grid-template-columns: 1fr;
  }

  body.is-home .compact-panel {
    padding: 12px;
  }

  body.is-home .compact-panel .eyebrow {
    margin-bottom: 8px;
  }

  body.is-home .compact-panel h4 {
    font-size: 20px;
  }

  body.is-home .compact-panel > p:not(.eyebrow) {
    margin-top: 8px;
    line-height: 1.5;
  }

  body.is-home .compact-panel ul {
    gap: 4px;
    margin-top: 8px;
    line-height: 1.4;
  }

  body.is-home .flow-step {
    min-height: auto;
    padding: 10px;
  }

  body.is-home .flow-step span {
    min-height: 24px;
    padding: 3px 8px;
  }

  body.is-home .flow-step strong {
    margin-top: 8px;
    font-size: 16px;
  }

  body.is-home .flow-step p {
    margin-top: 5px;
    line-height: 1.35;
  }

  body.is-home .recharge-panel-home .primary-btn {
    min-height: 38px;
    margin-top: 10px;
  }

  .form {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .promo-hero {
    min-height: auto;
    gap: 10px;
    padding: 18px 16px 18px;
  }

  .promo-copy {
    gap: 10px;
  }

  .promo-copy h3 {
    max-width: none;
    font-size: 28px;
  }

  .promo-copy p {
    font-size: 15px;
    line-height: 1.55;
  }

  .promo-actions > *,
  .recharge-method .primary-btn {
    width: 100%;
  }

  .promo-badges {
    gap: 6px;
  }

  .promo-badges span:nth-child(3) {
    display: none;
  }

  .promo-badges span {
    min-height: 28px;
    padding: 5px 8px;
  }

  .promo-device {
    padding: 12px;
  }

  .phone-frame {
    width: min(330px, 100%);
    padding: 10px 9px 10px;
    border-radius: 28px;
  }

  .phone-frame::before {
    border-radius: 21px;
  }

  .phone-speaker {
    width: 58px;
    height: 5px;
    margin-bottom: 8px;
  }

  .device-topline {
    gap: 6px;
    padding-bottom: 8px;
  }

  .device-topline strong {
    font-size: 18px;
  }

  .device-topline {
    grid-template-columns: 1fr;
  }

  .device-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
  }

  .device-metrics div,
  .device-feed article {
    min-height: auto;
    padding: 8px;
  }

  .device-metrics strong {
    font-size: 20px;
  }

  .device-feed {
    margin-top: 8px;
  }

  .device-feed p {
    line-height: 1.45;
  }

  .device-feed article:nth-child(3) {
    display: none;
  }

  .device-footer {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
  }

  .promo-strip {
    display: none;
  }

  .compact-tags {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0;
  }

  .promo-strip span,
  .promo-strip span:first-child,
  .compact-tags span,
  .compact-tags span:first-child {
    min-height: 56px;
    border-left: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .compact-grid,
  .usage-flow {
    grid-template-columns: 1fr;
  }

  .compact-panel {
    padding: 16px;
  }

  .flow-step {
    min-height: auto;
    padding: 14px;
  }

  .home-section {
    padding: 34px 18px;
  }

  .home-compact-page {
    min-height: auto;
    gap: 14px;
    padding: 30px 16px;
  }

  .home-section-head h3 {
    font-size: 26px;
  }

  .stat {
    min-height: 88px;
    padding: 14px;
  }

  .stat strong {
    font-size: 28px;
  }

  .item-head,
  .item-foot,
  .task-controls,
  .inline-actions,
  .member-actions,
  .template-actions,
  .settings-actions,
  .dialog-actions,
  .check-stage-tabs {
    align-items: stretch;
    flex-direction: column;
    display: flex;
  }

  .nav-tab {
    padding: 0 8px;
  }

  .login-actions {
    grid-template-columns: 1fr;
  }

  .image-preview {
    grid-template-columns: repeat(3, 1fr);
  }

  .quick-record button,
  .template-quick-add button {
    flex: 1 1 calc(50% - 8px);
    min-height: 40px;
  }

  .template-summary-grid {
    grid-template-columns: 1fr;
  }

  .support-bubble {
    right: 14px;
    bottom: 84px;
  }

  .support-toggle {
    width: 52px;
    height: 52px;
  }
}
