:root {
  --green: #d9342b;
  --brand: var(--green);
  --brand-dark: color-mix(in srgb, var(--green), #000 16%);
  --brand-soft: #fdecea;
  --cream: #faf5f4;
  --paper: #ffffff;
  --ink: #26191a;
  --text: var(--ink);
  --muted: #8c8180;
  --line: #efe1e0;
  --tint: #fdecea;
  --tint-strong: #fbdedb;
  --menubar-bg: #fdecea;
  --shadow: 0 14px 38px rgba(90, 20, 16, 0.1);
  --bg: var(--cream);
  --card: var(--paper);
  --ok: #2f8f57;
  --warn: #e8871e;
  --bad: #b5524b;
  --radius-lg: 26px;
  --radius-md: 14px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "IBM Plex Sans Thai", sans-serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* —— Login gate —— */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow: auto;
  background: linear-gradient(135deg, #fbe6e3, #fdf4f2 55%, #f8dedb);
}

.gate::before,
.gate::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(1px);
  opacity: 0.45;
  pointer-events: none;
}

.gate::before {
  width: 360px;
  height: 360px;
  background: #f0a9a2;
  left: -120px;
  top: -120px;
}

.gate::after {
  width: 280px;
  height: 280px;
  background: #f6c9a0;
  right: -80px;
  bottom: -100px;
}

.login-card {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-lg);
  padding: 32px 32px 28px;
  box-shadow: 0 28px 80px rgba(90, 20, 16, 0.16);
  position: relative;
  z-index: 1;
  animation: login-in 0.45s var(--ease-out);
}

@keyframes login-in {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.login-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 8px 22px rgba(217, 52, 43, 0.22);
}

.login-brand strong {
  display: block;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.login-brand span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.login-intro {
  margin: 24px 0 20px;
}

.login-intro h1 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.login-intro p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

.gate-form .field-label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}

.gate-form input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  background: #fff;
  font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.gate-form input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--tint);
}

.gate-form input::placeholder {
  color: #b0b8c4;
}

.password-input-wrap {
  position: relative;
  display: block;
}

.password-input-wrap input {
  padding-right: 72px;
}

.gate-form .show-password {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: var(--brand-soft);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
}

.gate-form .show-password:hover {
  background: #ffe8e4;
}

.login-submit {
  width: 100%;
  margin-top: 6px;
  border: 0;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 10px 28px rgba(217, 52, 43, 0.28);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.login-submit:hover {
  filter: brightness(1.04);
  box-shadow: 0 12px 32px rgba(217, 52, 43, 0.34);
}

.login-submit:active {
  transform: translateY(1px);
  box-shadow: 0 4px 14px rgba(217, 52, 43, 0.22);
}

.login-submit:disabled {
  opacity: 0.62;
  cursor: wait;
  transform: none;
}

.gate-step-intro {
  margin-bottom: 16px;
  text-align: left;
}
.gate-step-intro h1 {
  font-size: 1.35rem;
  margin: 0 0 6px;
}
.gate-step-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}
.gate-step-actions .login-submit {
  flex: 1;
}
.gate-step-totp .field-label {
  margin-top: 4px;
}
.gate-form .error {
  background: #ffebee;
  border: 1px solid #ffcdd2;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  color: #c62828;
  font-size: 14px;
  font-weight: 600;
}

.login-status {
  min-height: 20px;
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.turnstile-wrap {
  min-height: 65px;
  margin: 2px 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 8px;
}

.turnstile-wrap.hidden { display: none !important; }

.localhost-mode .turnstile-wrap { display: none !important; }

.card, .panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.card {
  width: min(420px, 100%);
  padding: 28px;
}

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

.platform-brand img {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 6px 18px rgba(198, 40, 40, 0.18);
}

.platform-brand strong {
  display: block;
  font-size: 20px;
  letter-spacing: 0.02em;
}

.platform-brand span {
  color: var(--muted);
  font-size: 13px;
}

.platform-brand.compact img {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  box-shadow: 0 4px 14px rgba(217, 52, 43, 0.15);
}

.platform-brand.compact .eyebrow {
  margin-bottom: 2px;
}

.platform-brand.compact h1 {
  margin: 0;
}

.top-title h1 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 3px;
  color: #79837e;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, h3 { margin: 0 0 12px; }
.muted { color: var(--muted); margin: 0 0 18px; }

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
}

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

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}

a.link-btn.ghost {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: inherit;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

button.primary { width: 100%; }

.error {
  color: var(--bad);
  font-size: 13px;
  margin: 0 0 10px;
}

body.drawer-open { overflow: hidden; }

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
}

.platform-topbar.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 82px;
  padding: 12px 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 12px rgba(90, 20, 16, 0.05);
  position: sticky;
  top: 0;
  z-index: 30;
}

.platform-topbar .top-title {
  min-width: 0;
}

.platform-topbar h1 {
  font-size: clamp(1.15rem, 2.5vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.platform-main.app-shell {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 28px 40px;
  animation: app-in 0.4s var(--ease-out);
}

@keyframes app-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.platform-brand.compact img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(217, 52, 43, 0.18);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.btn-icon .icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

button.primary .btn-icon .icon,
button.primary.sm .btn-icon .icon {
  stroke: #fff;
}

.top-nav-btn {
  min-height: 42px;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 13px;
  border: 1px solid color-mix(in srgb, var(--line), var(--brand) 18%);
  background: var(--menubar-bg);
  color: var(--brand);
}

.top-nav-btn:hover {
  background: var(--paper);
  box-shadow: 0 3px 9px rgba(90, 20, 16, 0.08);
}

.top-nav-btn .icon {
  stroke: var(--brand);
}

.top-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

button.ghost {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

button.ghost:hover {
  background: #faf9f5;
  border-color: color-mix(in srgb, var(--line), var(--brand) 25%);
}

button.ghost.sm {
  padding: 8px 12px;
  font-size: 12px;
}

button.ghost.danger-outline {
  color: var(--brand);
  border-color: rgba(217, 52, 43, 0.25);
}

button.ghost.danger-outline:hover {
  background: var(--brand-soft);
  border-color: rgba(217, 52, 43, 0.4);
}

button.ghost.top-nav-btn {
  background: var(--menubar-bg);
  color: var(--brand);
  border: 1px solid color-mix(in srgb, var(--line), var(--brand) 18%);
}

button.ghost.top-nav-btn:hover {
  background: var(--paper);
  border-color: color-mix(in srgb, var(--line), var(--brand) 28%);
  box-shadow: 0 3px 9px rgba(90, 20, 16, 0.08);
}

button.ghost.top-nav-btn.danger-outline {
  background: var(--paper);
}

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

.stat-card {
  background: #f4f2ec;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 16px 14px;
  box-shadow: none;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

.stat-total::before { background: #6366f1; }
.stat-active::before { background: var(--ok); }
.stat-demo::before { background: #0ea5e9; }
.stat-warn::before { background: var(--warn); }
.stat-danger::before { background: var(--bad); }

.stat-card small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 8px;
}

.stat-card b {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--brand);
}

.stat-hint {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr min(340px, 32%);
  gap: 18px;
  align-items: start;
}

.layout-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.panel {
  padding: 20px 22px;
}

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

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stores-toolbar {
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.stores-toolbar .search-field {
  min-width: min(220px, 42vw);
}

.panel-stores .panel-head {
  align-items: center;
}

@media (max-width: 720px) {
  .panel-stores .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .stores-toolbar {
    width: 100%;
    flex-wrap: wrap;
  }

  .stores-toolbar .search-field {
    flex: 1;
    min-width: 0;
  }
}

button.primary.sm {
  width: auto;
  margin-top: 0;
  padding: 10px 14px;
  font-size: 13px;
  white-space: nowrap;
}

.side-custom-btn {
  width: 100%;
  margin-top: 14px;
  padding: 11px 14px;
  font-weight: 600;
}

.panel-head h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
}

.panel-desc {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(260px, 100%);
  min-height: 44px;
  padding: 6px 8px 6px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 4px 15px rgba(20, 40, 30, 0.03);
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.search-field:focus-within {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  box-shadow: 0 0 0 3px var(--tint);
}

.search-field input {
  border: 0;
  background: transparent;
  padding: 10px 0;
  margin: 0;
  box-shadow: none;
}

.search-field input:focus {
  outline: none;
}

.search-icon {
  color: var(--muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.search-icon .icon {
  width: 17px;
  height: 17px;
}

.data-table thead th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  background: #f4f2ec;
}

.data-table tbody tr {
  transition: background 0.12s;
}

.data-table tbody tr:hover {
  background: #faf9f8;
}

.data-table tbody tr.is-selected {
  background: var(--brand-soft);
}

.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #f0f1f3;
  vertical-align: middle;
}

.store-cell b {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

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

.plan-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.plan-pill.basic,
.plan-pill.basic_plus {
  background: #eef2ff;
  color: #4338ca;
}

.plan-pill.basic_plus {
  border: 1px solid rgba(67, 56, 202, 0.2);
}

.plan-pill.pro,
.plan-pill.pro_plus {
  background: linear-gradient(135deg, #fff5f3, #ffe8e4);
  color: var(--brand-dark);
  border: 1px solid rgba(217, 52, 43, 0.12);
}

.plan-pill.pro_plus {
  font-weight: 800;
}

.plan-pill.lifetime,
.plan-pill.lifetime_plus {
  background: linear-gradient(135deg, #fef9c3, #fde68a);
  color: #92400e;
  border: 1px solid rgba(146, 64, 14, 0.15);
}

.plan-pill.lifetime_plus {
  font-weight: 800;
}

.device-tag {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}

.device-online {
  color: #0369a1;
  font-weight: 700;
}

input.locked,
input:read-only.locked {
  background: #f3f4f6;
  color: var(--muted);
  cursor: not-allowed;
  border-color: var(--line);
}

.custom-fields {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px dashed rgba(217, 52, 43, 0.25);
  border-radius: 12px;
  background: #fffaf9;
}

.custom-fields .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.doc-actions { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.doc-buyer-row { margin-bottom: 10px; }
.doc-issue-row { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.pay-actions-cell { white-space: nowrap; }
.pay-actions-cell .ghost { margin-right: 4px; }

.login-cred-box {
  margin: 0 0 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff 0%, #fafafa 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-cred-url {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f3f4f6;
  border: 1px solid var(--line);
}

.login-cred-url > span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.login-cred-url code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: #1a1a1a;
  word-break: break-all;
}

.login-cred-card {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.login-cred-card--admin {
  border-color: #f5c2c7;
  background: linear-gradient(180deg, #fff 0%, #fff8f8 100%);
}

.login-cred-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.login-cred-card-head small {
  flex: 1 1 180px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.login-cred-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.login-cred-badge--admin {
  color: #9b1c1c;
  background: #fde8e8;
  border: 1px solid #f5c2c7;
}

.login-cred-badge--staff {
  color: #1e4f8a;
  background: #e8f1fd;
  border: 1px solid #c7daf5;
}

.login-cred-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.login-cred-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  min-width: 0;
}

.login-cred-field > span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.login-cred-field code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  word-break: break-all;
  line-height: 1.35;
}

.login-cred-field code.login-cred-secret {
  color: var(--brand);
  letter-spacing: 0.03em;
}

.login-cred-staff {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #c7daf5;
  background: linear-gradient(180deg, #fff 0%, #f7faff 100%);
}

.login-cred-staff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
}

.login-cred-device {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #dbe7f5;
  min-width: 0;
}

.login-cred-presence {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}

.login-cred-presence.online {
  background: #e6f6ec;
  color: #167a3a;
}

.login-cred-presence.offline {
  background: #f0f0f0;
  color: #777;
}

.login-cred-device-no {
  font-size: 11px;
  font-weight: 700;
  color: #1e4f8a;
}

.login-cred-device-user {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  color: #1a1a1a;
  word-break: break-all;
  line-height: 1.35;
}

.login-cred-device-hint {
  font-size: 10px;
  color: var(--muted);
}

.login-phone-hint {
  color: var(--brand, #c62828);
  margin: 0;
}

.login-cred-foot {
  margin: 0;
  font-size: 11px;
}

.login-cred-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 520px) {
  .login-cred-fields {
    grid-template-columns: 1fr;
  }
}

.create-hint { margin: 0 0 12px; }

.store-id-row {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.store-id-row:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent);
}

.store-id-prefix {
  padding: 10px 0 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
  user-select: none;
  max-width: 52%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.store-id-row input {
  flex: 1;
  border: 0;
  border-radius: 0;
  padding: 10px 12px 10px 4px;
  min-width: 0;
  box-shadow: none;
}

.store-id-row input:focus {
  outline: none;
  box-shadow: none;
}

.store-data-box {
  margin: 0 0 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.store-data-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.store-stat {
  padding: 8px 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: center;
}

.store-stat span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.store-stat b {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.2;
}

.store-data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.store-data-card {
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.store-data-card-title {
  font-size: 13px;
  font-weight: 700;
}

.store-data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.store-data-actions .ghost.sm {
  padding: 5px 8px;
  font-size: 11px;
  line-height: 1.2;
}

.store-data-opt {
  margin: 0;
  font-size: 11px;
  gap: 6px;
}

.store-data-foot {
  margin: 0;
  font-size: 11px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 520px) {
  .store-data-grid { grid-template-columns: 1fr; }
}

.import-result { margin: 0; min-height: 0; font-size: 11px; line-height: 1.3; }

.upload-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.import-result.ok { color: #1e7e34; }

.import-result.err { color: #c0392b; }

.danger-zone-box {
  margin: 0 0 12px;
  padding: 12px;
  border: 1px solid #e8c5c2;
  border-radius: 12px;
  background: #fdf3f2;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.danger-button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: #c0392b;
  color: #fff;
}

.danger-button:hover { background: #a93226; }

.danger-button-outline {
  background: #fff;
  color: #c0392b;
  border: 1px solid #e8c5c2;
}

.danger-button-outline:hover { background: #fdf3f2; }

.danger-scope-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  margin: 4px 0 8px;
}

.danger-scope-grid .checkbox-row {
  font-size: 13px;
  color: #5c2e2a;
}

.danger-quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.danger-ghost {
  color: #c0392b !important;
  border-color: #e8c5c2 !important;
}

.danger-ghost:hover {
  background: #fff !important;
}

.panel-head-sub {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.pkg-catalog {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.pkg-card {
  display: grid;
  gap: 6px;
  padding: 14px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  font-size: 13px;
  box-shadow: 0 4px 15px rgba(20, 40, 30, 0.03);
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.15s;
}

.pkg-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--tint-strong);
}

.pkg-card b {
  font-size: 14px;
  color: var(--ink);
}

.pkg-card small {
  color: var(--muted);
}

.sub-summary-box {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid #d4e8df;
  border-radius: 12px;
  background: linear-gradient(180deg, #f4fbf7, #fff);
}

.sub-summary-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.sub-summary-head .meta {
  display: block;
  margin-bottom: 4px;
}

.sub-days-badge {
  font-size: 15px;
  font-weight: 700;
  color: #1e7e34;
  white-space: nowrap;
}

.sub-days-badge.warn { color: #b8860b; }

.sub-days-badge.danger { color: #c0392b; }

.sub-days-badge.lifetime { color: #6b4c9a; }

.sub-summary-rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  font-size: 12px;
}

.sub-summary-rows div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.sub-summary-rows span { color: var(--muted); }

.sub-summary-divider {
  height: 1px;
  background: #d4e8df;
  margin: 10px 0;
}

.renew-form-inline {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #d4e8df;
}

.sub-manage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}

.sub-manage-grid label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
}

.sub-manage-grid .span-2 { grid-column: 1 / -1; }

.sub-manage-grid input,
.sub-manage-grid select {
  display: block;
  width: 100%;
  margin-top: 4px;
  border: 1px solid #c8ddd4;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  background: #fff;
}

.sub-manage-grid .renew-summary {
  margin: 0;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.75);
  border-color: #c8ddd4;
}

.sub-summary-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.sub-summary-btns .primary { margin: 0; }

.sub-manage-grid .doc-issue-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

@media (max-width: 520px) {
  .sub-manage-grid { grid-template-columns: 1fr; }
  .sub-manage-grid .span-2 { grid-column: auto; }
  .sub-summary-btns { grid-template-columns: 1fr; }
}

.plan-pill.custom {
  background: #f3e8ff;
  color: #7c3aed;
  border: 1px solid rgba(124, 58, 237, 0.2);
}

.plan-pill.demo {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid rgba(14, 165, 233, 0.25);
}

.demo-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  border-radius: 999px;
  vertical-align: middle;
}

.demo-create-btn {
  border-color: rgba(14, 165, 233, 0.35);
  color: #0369a1;
}

.demo-online-panel {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #bae6fd;
  border-radius: 14px;
  background: linear-gradient(180deg, #f0f9ff, #fff);
}

.demo-online-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.demo-online-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.demo-online-list {
  display: grid;
  gap: 6px;
}

.demo-online-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
}

.demo-online-row small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.demo-online-badge {
  font-size: 12px;
  font-weight: 700;
  color: #0369a1;
  white-space: nowrap;
}

.expense-gcp-status {
  margin: 0 0 8px;
  font-size: 12px;
}

.expense-sync-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 600;
}

.panel-expenses {
  margin-top: 0;
}

.expenses-modal-head {
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

.expenses-modal-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.expenses-modal-top .modal-close {
  flex-shrink: 0;
  margin-top: 2px;
}

.expenses-modal-head .expense-toolbar {
  width: 100%;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.expenses-modal-body {
  overflow: auto;
  max-height: min(72vh, 780px);
}

.expenses-table-wrap {
  max-height: min(42vh, 420px);
  overflow: auto;
}

.payment-submissions-body {
  overflow: auto;
  max-height: min(72vh, 780px);
}

.payment-submissions-layout {
  display: grid;
  grid-template-columns: 1fr min(320px, 38%);
  gap: 16px;
  align-items: start;
}

.payment-submissions-table-wrap {
  max-height: min(58vh, 520px);
  overflow: auto;
}

.payment-submission-detail {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fafafa;
}

.payment-submission-detail h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.payment-slip-preview {
  margin: 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.payment-slip-preview img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
}

.payment-submission-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.payment-sub-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.payment-sub-status-pending { background: #fef3c7; color: #b45309; }
.payment-sub-status-approved { background: #dcfce7; color: #15803d; }
.payment-sub-status-rejected { background: #fee2e2; color: #b91c1c; }

.payment-sub-row { cursor: pointer; }
.payment-sub-row-active { background: #fff8f7; }
.payment-sub-row-active td { background: #fff8f7; }

@media (max-width: 900px) {
  .payment-submissions-layout { grid-template-columns: 1fr; }
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.line-support-body {
  overflow: auto;
  max-height: min(78vh, 820px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* LINE Official Account Manager shell */
.modal-panel.line-oa-shell {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  padding: 0;
  max-width: min(1180px, 96vw);
  width: 96vw;
  height: min(92vh, 900px);
  max-height: min(92vh, 900px);
  overflow: hidden;
  background: #f5f6f7;
}

.line-oa-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 10px;
  background: #1e1f22;
  color: #e8e8e8;
  border-right: 1px solid #111;
  overflow: auto;
}

.line-oa-nav-brand {
  display: grid;
  gap: 2px;
  padding: 4px 8px 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.line-oa-nav-logo {
  display: inline-grid;
  place-items: center;
  width: fit-content;
  padding: 2px 8px;
  border-radius: 6px;
  background: #06c755;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.line-oa-nav-brand b {
  font-size: 12px;
  font-weight: 600;
  color: #cfd3d8;
}

.line-oa-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c8ccd2;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.line-oa-nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }

.line-oa-nav-item.active {
  background: #06c755;
  color: #fff;
}

.line-oa-nav-ico {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
  flex-shrink: 0;
}

.line-oa-nav-item.active .line-oa-nav-ico { opacity: 1; background: #fff; }

.line-oa-nav-settings { margin-top: auto; }

.line-oa-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: #fff;
}

.line-oa-head {
  padding: 12px 16px 10px !important;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  flex-shrink: 0;
}

.line-oa-toolbar.hidden { display: none; }

.line-oa-shell .line-support-body {
  max-height: none;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px 16px;
}

.line-oa-compose-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.line-oa-compose-form {
  min-width: 0;
}

.line-broadcast-multi-list {
  display: grid;
  gap: 8px;
  margin: 8px 0;
}

.line-broadcast-part {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fafafa;
  display: grid;
  gap: 8px;
}

.line-broadcast-part-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #374151;
}

.line-broadcast-part textarea,
.line-broadcast-part input[type="file"] {
  width: 100%;
}

.line-broadcast-part-preview {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.line-oa-send-btn {
  background: #06c755 !important;
  border-color: #06c755 !important;
}

.line-phone-preview {
  position: sticky;
  top: 8px;
  justify-self: center;
}

.line-phone-frame {
  width: 280px;
  border-radius: 28px;
  border: 3px solid #1f2937;
  background: #111;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}

.line-phone-notch {
  height: 18px;
  background: #111;
  position: relative;
}

.line-phone-notch::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 6px;
  transform: translateX(-50%);
  width: 72px;
  height: 6px;
  border-radius: 999px;
  background: #2a2a2a;
}

.line-phone-header {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
}

.line-phone-chat {
  min-height: 360px;
  max-height: 420px;
  overflow: auto;
  padding: 12px 10px;
  background:
    radial-gradient(circle at 20% 10%, rgba(6,199,85,0.08), transparent 40%),
    linear-gradient(180deg, #b9d4c8 0%, #c7dccf 45%, #d4e4da 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.line-phone-composer {
  height: 42px;
  display: grid;
  place-items: center;
  background: #f7f7f7;
  border-top: 1px solid #e5e7eb;
  color: #9ca3af;
  font-size: 12px;
}

.line-phone-bubble {
  max-width: 86%;
  padding: 8px 11px;
  border-radius: 16px;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}

.line-phone-bubble.in {
  align-self: flex-start;
  background: #fff;
  border-bottom-left-radius: 4px;
}

.line-phone-bubble.out {
  align-self: flex-end;
  background: #06c755;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.line-phone-flex {
  align-self: flex-end;
  width: 88%;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.line-phone-flex img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
  background: #e5e7eb;
}

.line-phone-flex-body {
  padding: 10px;
  display: grid;
  gap: 6px;
}

.line-phone-flex-body b {
  font-size: 13px;
  color: #111;
}

.line-phone-flex-body p {
  margin: 0;
  font-size: 11px;
  color: #6b7280;
  white-space: pre-wrap;
}

.line-phone-flex-btn {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: #06c755;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.line-phone-flex-header {
  padding: 10px 12px 6px;
  background: #06c755;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.line-phone-flex-rows {
  display: grid;
  gap: 4px;
  margin: 6px 0 2px;
}

.line-phone-flex-rows > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.line-phone-flex-rows span { color: #374151; }
.line-phone-flex-rows b { color: #06c755; font-weight: 700; text-align: right; }

.line-phone-flex-note {
  margin: 6px 0 0 !important;
  font-size: 10px !important;
  color: #9ca3af !important;
}

.line-phone-flex-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}

.line-phone-flex-actions.stack {
  grid-template-columns: 1fr;
}

.line-phone-img {
  align-self: flex-end;
  max-width: 78%;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.line-phone-img img {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
}

.line-rich-chat-mock {
  max-width: 560px;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

.line-rich-chat-mock .line-rich-preview {
  max-width: none;
  border: 0;
  border-radius: 0;
}

.line-rich-chatbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  background: #f3f4f6;
  border-top: 1px solid #e5e7eb;
  color: #374151;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 960px) {
  .modal-panel.line-oa-shell {
    grid-template-columns: 1fr;
    max-height: min(94vh, 960px);
  }
  .line-oa-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px;
  }
  .line-oa-nav-brand { display: none; }
  .line-oa-nav-settings { margin-top: 0; }
  .line-oa-nav-item { width: auto; padding: 8px 10px; }
  .line-oa-compose-layout { grid-template-columns: 1fr; }
  .line-phone-preview { position: static; justify-self: start; }
}

.line-support-config {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fafafa;
}

.line-support-config-form {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.line-support-layout {
  display: grid;
  grid-template-columns: min(280px, 34%) 1fr;
  gap: 12px;
  min-height: min(58vh, 560px);
  align-items: stretch;
}

.line-support-threads {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  max-height: min(58vh, 560px);
  background: #fff;
}

.line-thread-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.line-thread-item:hover { background: #f8f8f8; }
.line-thread-item.active { background: #eefbf3; }
.line-thread-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #e5e7eb;
}
.line-thread-avatar.placeholder {
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #6b7280;
}
.line-thread-name {
  font-weight: 700;
  font-size: 13px;
  margin: 0;
}
.line-thread-preview {
  margin: 2px 0 0;
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.line-thread-meta {
  text-align: right;
  font-size: 11px;
  color: #9ca3af;
}
.line-thread-unread {
  display: inline-flex;
  min-width: 1.1rem;
  justify-content: center;
  margin-top: 4px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #06c755;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.line-support-chat {
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: min(58vh, 560px);
  background: #fff;
  overflow: hidden;
  position: relative;
}

.line-support-chat.drag-over {
  outline: 2px solid #06c755;
  outline-offset: -2px;
}

.line-support-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  gap: 4px;
  text-align: center;
  background: rgba(6, 199, 85, 0.12);
  border: 2px dashed #06c755;
  border-radius: 12px;
  pointer-events: none;
  color: #0b7a3b;
}

.line-support-drop-overlay.hidden { display: none; }

.line-support-drop-overlay b {
  font-size: 16px;
}

.line-support-drop-overlay span {
  font-size: 12px;
  opacity: 0.85;
}

.line-support-chat-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #fafafa;
}

.line-support-chat-head h3 {
  margin: 0;
  font-size: 15px;
}

.line-support-chat-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.line-support-messages {
  flex: 1;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background:
    radial-gradient(circle at 12% 8%, rgba(6,199,85,0.07), transparent 42%),
    linear-gradient(180deg, #c5d9cd 0%, #d2e2d8 55%, #dce8e1 100%);
  max-height: min(42vh, 420px);
}

.line-msg {
  max-width: min(85%, 420px);
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.line-msg-in {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.line-msg-out {
  align-self: flex-end;
  background: #06c755;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.line-msg-system {
  align-self: center;
  background: transparent;
  color: #6b7280;
  font-size: 12px;
  text-align: center;
  max-width: 90%;
}

.line-msg time {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  opacity: 0.7;
}

.line-msg img {
  display: block;
  max-width: 220px;
  max-height: 220px;
  border-radius: 8px;
  margin-top: 4px;
}

.line-support-reply {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  display: grid;
  gap: 8px;
  background: #fff;
}

.line-support-store-link {
  font-size: 12px;
  color: #6b7280;
  display: grid;
  gap: 4px;
}

.line-support-reply-row {
  display: flex;
  gap: 8px;
}

.line-support-reply-row input {
  flex: 1;
}

.line-msg-sticker {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: contain;
  background: transparent;
  border: 0;
  margin: 0;
}

.line-msg-out .line-msg-sticker,
.line-msg-in.line-msg-sticker-only {
  background: transparent;
}

.line-msg.line-msg-sticker-only {
  padding: 4px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.line-support-emoji-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 0;
}

.line-support-emoji-bar.hidden { display: none; }

.line-support-emoji-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: #f3f4f6;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.line-support-emoji-btn:hover { background: #e5e7eb; }

.line-support-sticker-panel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px;
  max-height: 180px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
}

.line-support-sticker-panel.hidden { display: none; }

.line-support-sticker-btn {
  border: 1px solid transparent;
  border-radius: 10px;
  background: #fff;
  padding: 4px;
  cursor: pointer;
}

.line-support-sticker-btn:hover {
  border-color: #06c755;
  background: #f0fdf4;
}

.line-support-sticker-btn img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}

.line-support-sticker-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.line-support-attach-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.line-support-attach-name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-msg-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
  color: inherit;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.line-msg-out .line-msg-file {
  background: rgba(255, 255, 255, 0.2);
}

.line-support-tabs .line-tab.active {
  background: #06c755;
  color: #fff;
  border-color: #06c755;
}

.line-tab-panel.hidden { display: none; }

.line-rich-editor {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 14px;
  align-items: start;
}

.line-rich-editor-main h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.line-rich-layout-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
}

.line-rich-layout-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px 6px;
  cursor: pointer;
  display: grid;
  gap: 6px;
  justify-items: center;
  font: inherit;
  color: inherit;
}

.line-rich-layout-btn.active {
  border-color: #06c755;
  box-shadow: 0 0 0 2px rgba(6, 199, 85, 0.2);
}

.line-rich-layout-mini {
  width: 72px;
  height: 36px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  display: grid;
  overflow: hidden;
  background: #f3f4f6;
}

.line-rich-layout-mini span {
  border: 1px solid rgba(0,0,0,0.08);
  background: #e5e7eb;
}

.line-rich-layout-btn small {
  font-size: 10px;
  color: #6b7280;
  text-align: center;
  line-height: 1.2;
}

.line-rich-preview-wrap { margin-bottom: 10px; }

.line-rich-preview {
  position: relative;
  width: 100%;
  max-width: 560px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #111;
  aspect-ratio: 2500 / 843;
}

.line-rich-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.line-rich-areas { position: absolute; inset: 0; }

.line-rich-area {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: rgba(6, 199, 85, 0.18);
  color: #fff;
  display: grid;
  place-content: center;
  gap: 2px;
  cursor: pointer;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
  box-sizing: border-box;
  font: inherit;
  padding: 0;
}

.line-rich-area.active {
  background: rgba(6, 199, 85, 0.38);
  border-color: #06c755;
  z-index: 2;
}

.line-rich-area b { font-size: 14px; }
.line-rich-area small {
  font-size: 10px;
  opacity: 0.95;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-rich-area-editor {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.line-rich-area-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fafafa;
  display: grid;
  gap: 8px;
}

.line-rich-area-card.active {
  border-color: #06c755;
  background: #f0fdf4;
}

.line-rich-area-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.line-rich-file-label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #6b7280;
}

.line-rich-menu-thumb {
  width: 100%;
  max-height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eee;
}

@media (max-width: 900px) {
  .line-rich-editor { grid-template-columns: 1fr; }
}

.line-tool-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
  align-items: start;
}

.line-tool-form h3,
.line-tool-side h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.line-tool-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.line-tool-row input {
  flex: 1;
  min-width: 140px;
}

.line-tool-side {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fafafa;
}

.line-tool-side-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.line-tool-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

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

.line-tool-item b {
  font-size: 13px;
}

.line-tool-item .meta {
  font-size: 12px;
}

.line-tool-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 900px) {
  .line-tool-grid { grid-template-columns: 1fr; }
  .line-support-layout { grid-template-columns: 1fr; }
  .line-support-threads { max-height: 220px; }
}

.expense-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.expense-filter {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  background: #fff;
}

.expense-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 14px;
}

.expense-stat {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
}

.expense-stat small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

.expense-stat b {
  font-size: 18px;
  color: var(--text);
}

.expense-table td b {
  display: block;
}

.expense-table .meta {
  display: block;
  margin-top: 2px;
}

.expense-cat {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #f3f4f6;
  color: #374151;
}

.expense-cat-hosting { background: #dbeafe; color: #1d4ed8; }
.expense-cat-tools { background: #ede9fe; color: #6d28d9; }
.expense-cat-marketing { background: #ffedd5; color: #c2410c; }
.expense-cat-salary { background: #dcfce7; color: #15803d; }

.expense-actions {
  white-space: nowrap;
}

.expense-actions .ghost {
  margin-left: 4px;
}

.danger-text {
  color: var(--bad) !important;
}

@media (max-width: 720px) {
  .expense-summary { grid-template-columns: 1fr; }
}

.date-cell small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}

.date-cell small.days-warn {
  color: var(--warn);
  font-weight: 600;
}

.btn-manage {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid rgba(217, 52, 43, 0.15);
  border-radius: 999px;
  transition: background 0.15s, transform 0.12s;
}

.btn-manage:hover {
  background: #ffe8e4;
  transform: translateY(-1px);
}

.empty-cell {
  text-align: center;
  padding: 40px 16px !important;
}

.empty-state b {
  display: block;
  margin-bottom: 4px;
}

.empty-state small {
  color: var(--muted);
}

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

.panel-side .create-form label {
  margin-bottom: 14px;
}

.panel-side input,
.panel-side select {
  border-radius: 12px;
  padding: 11px 13px;
  border-color: #e5e7eb;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.panel-side input:focus,
.panel-side select:focus,
.panel-side textarea:focus {
  outline: none;
  border-color: rgba(217, 52, 43, 0.4);
  box-shadow: 0 0 0 3px rgba(217, 52, 43, 0.08);
}

button.primary {
  width: 100%;
  margin-top: 6px;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: 0 8px 20px rgba(217, 52, 43, 0.28);
  transition: filter 0.16s, transform 0.16s, box-shadow 0.16s;
}

button.primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 11px 26px rgba(217, 52, 43, 0.34);
}

button.primary:active {
  transform: translateY(0);
}

body.drawer-open { overflow: hidden; }

.modal-panel-detail {
  width: min(600px, 100%);
  max-height: min(92vh, 900px);
}

.detail-modal-body {
  padding-top: 12px;
}

.detail-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}

.detail-form-compact label {
  margin-bottom: 0;
  font-size: 12px;
  font-weight: 600;
  gap: 4px;
}

.detail-form-compact .span-2 {
  grid-column: 1 / -1;
}

.detail-form-compact input,
.detail-form-compact select,
.detail-form-compact textarea {
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 400;
}

.detail-meta-line {
  margin: 8px 0 10px;
  font-size: 11px;
  line-height: 1.4;
}

.detail-save-btn {
  width: 100%;
  margin-top: 0;
  padding: 10px 14px;
}

.detail-modal-body h3 {
  font-size: 13px;
  margin: 0 0 8px;
}

.detail-modal-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 12px 0;
}

@media (max-width: 520px) {
  .detail-form-grid { grid-template-columns: 1fr; }
  .detail-form-compact .span-2 { grid-column: auto; }
}

.detail-form h3,
.detail-drawer h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 12px;
}

.detail-form input,
.detail-form select,
.detail-form textarea {
  border-radius: 10px;
}

#renewLink {
  word-break: break-all;
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 12px;
}

.renew-summary {
  display: grid;
  gap: 8px;
  margin: 4px 0 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fafafa, #fff5f3);
  border: 1px solid rgba(217, 52, 43, 0.12);
  border-radius: 12px;
  font-size: 13px;
}

.renew-summary div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.renew-summary span:first-child {
  color: var(--muted);
  font-size: 12px;
}

.renew-summary b {
  font-weight: 600;
  text-align: right;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  z-index: 10050;
  box-shadow: 0 12px 40px rgba(17, 24, 39, 0.25);
  pointer-events: none;
}

.chat-notify {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 10060;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 12px 12px 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #d1d5db;
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.18);
}

.chat-notify.hidden { display: none; }

.chat-notify-body {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.chat-notify-body b {
  font-size: 13px;
  color: #111827;
}

.chat-notify-body span {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-notify-close {
  min-width: 32px;
  padding-inline: 8px;
}

.settings-block {
  background: #f4f2ec;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}

@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .layout { grid-template-columns: 1fr; }
  .platform-topbar.topbar { flex-direction: column; align-items: stretch; padding: 14px 16px; }
  .top-actions { justify-content: flex-start; }
  .panel-head { flex-direction: column; }
  .search-field { width: 100%; }
}

@media (max-width: 520px) {
  .platform-main.app-shell { padding: 12px 14px 28px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card b { font-size: 22px; }
  .form-row { grid-template-columns: 1fr; }
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge.active, .badge.trial { background: #e8f5e9; color: var(--ok); }
.badge.expired, .badge.suspended { background: #ffebee; color: var(--bad); }

.detail-form, .create-form, .renew-form { display: grid; gap: 0; }
.meta { color: var(--muted); font-size: 12px; line-height: 1.5; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

.table-wrap { overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  vertical-align: top;
}
.settings-page { margin-top: 0; }
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.settings-block h3 { margin-bottom: 6px; }
.settings-form { display: grid; gap: 0; }
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 500;
}
.checkbox-row input { width: auto; }
.totp-setup { text-align: center; margin-bottom: 12px; }
.totp-setup img { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.secret-code {
  display: block;
  word-break: break-all;
  font-size: 12px;
  padding: 8px 10px;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
}
.system-status-block { grid-column: 1 / -1; }

.system-status-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(255, 255, 255, 0.9), transparent 55%),
    linear-gradient(135deg, #fff 0%, #faf5f4 100%);
  margin-bottom: 4px;
}

.system-status-hero[data-level="good"] {
  border-color: #b7ebc9;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(240, 253, 244, 0.95), transparent 55%),
    linear-gradient(135deg, #f7fdf9 0%, #eefbf3 100%);
}

.system-status-hero[data-level="warn"] {
  border-color: #f5d39a;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(255, 251, 235, 0.95), transparent 55%),
    linear-gradient(135deg, #fffdf8 0%, #fff7eb 100%);
}

.system-status-hero[data-level="bad"] {
  border-color: #f0c2c2;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(254, 242, 242, 0.95), transparent 55%),
    linear-gradient(135deg, #fffafa 0%, #fef2f2 100%);
}

.system-status-hero-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.system-status-level {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  background: var(--muted);
}

.system-status-hero[data-level="good"] .system-status-level { background: var(--ok); }
.system-status-hero[data-level="warn"] .system-status-level { background: var(--warn); }
.system-status-hero[data-level="bad"] .system-status-level { background: var(--bad); }

.system-status-summary {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.35;
}

.system-status-hero-meta {
  text-align: right;
  flex-shrink: 0;
}

.system-status-score {
  display: block;
  font-size: 28px;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.system-status-hero-meta .meta {
  margin: 6px 0 0;
  font-size: 11px;
}

.system-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.status-section,
.status-runtime {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(90, 20, 16, 0.04);
}

.status-runtime {
  grid-column: 1 / -1;
}

.status-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-section-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  flex-shrink: 0;
  background:
    center / 18px no-repeat,
    linear-gradient(180deg, #fff 0%, var(--tint) 100%);
  border: 1px solid var(--line);
}

.status-section-icon--shield {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d9342b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #fff 0%, var(--tint) 100%);
}

.status-section-icon--server {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d9342b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='3' width='20' height='8' rx='2'/%3E%3Crect x='2' y='13' width='20' height='8' rx='2'/%3E%3Ccircle cx='6' cy='7' r='1' fill='%23d9342b'/%3E%3Ccircle cx='6' cy='17' r='1' fill='%23d9342b'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #fff 0%, var(--tint) 100%);
}

.status-section-icon--runtime {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d9342b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #fff 0%, var(--tint) 100%);
}

.status-section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.status-section-sub {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.status-section-cards {
  display: grid;
  gap: 8px;
}

.status-card {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
}

.status-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(90, 20, 16, 0.06);
}

.status-card.ok {
  border-color: color-mix(in srgb, #86efac 70%, var(--line));
  background: linear-gradient(180deg, #ffffff 0%, #f3fdf6 100%);
}

.status-card.bad {
  border-color: color-mix(in srgb, #fca5a5 70%, var(--line));
  background: linear-gradient(180deg, #ffffff 0%, #fff5f5 100%);
}

.status-card.warn {
  border-color: color-mix(in srgb, #fcd34d 70%, var(--line));
  background: linear-gradient(180deg, #ffffff 0%, #fffbeb 100%);
}

.status-card-mark {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: var(--muted);
}

.status-card.ok .status-card-mark { background: var(--ok); }
.status-card.bad .status-card-mark { background: var(--bad); }
.status-card.warn .status-card-mark { background: var(--warn); }

.status-card-body {
  min-width: 0;
}

.status-card b {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 3px;
  color: var(--ink);
}

.status-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.status-runtime-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 0;
}

.status-runtime-grid > div {
  padding: 8px 10px;
  border-radius: 10px;
  background: #faf7f6;
  border: 1px solid var(--line);
  min-width: 0;
}

.status-runtime-grid .span-2 { grid-column: 1 / -1; }

.status-runtime-grid dt {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.status-runtime-grid dd {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--ink);
  word-break: break-all;
  line-height: 1.4;
}

.status-runtime-grid a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

.status-runtime-grid a:hover { text-decoration: underline; }

.status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.status-head h3 { margin: 0; font-size: 14px; }

.system-status-charts {
  grid-column: 1 / -1;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(90, 20, 16, 0.04);
}

.status-chart-wrap {
  margin-top: 10px;
  padding: 10px 12px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff 0%, #fcf8f7 100%);
}
.chart-caption {
  margin: 0 0 6px;
  font-size: 12px;
}
.status-chart-attack {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fff 0%, #fff5f5 100%);
}
.system-status-charts canvas {
  width: 100% !important;
  max-height: 160px;
}

@media (max-width: 820px) {
  .system-status-grid { grid-template-columns: 1fr; }
  .system-status-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .system-status-hero-meta { text-align: left; }
  .status-runtime-grid { grid-template-columns: 1fr; }
  .status-runtime-grid .span-2 { grid-column: auto; }
}

.modal-backdrop {
  position: fixed !important;
  inset: 0;
  z-index: 250;
  background: rgba(45, 14, 12, 0.5);
  backdrop-filter: blur(4px);
  overflow-y: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 20px;
  box-sizing: border-box;
  animation: modal-in 0.2s var(--ease-out);
}
.modal-backdrop.hidden {
  display: none !important;
}
.modal-backdrop:not(.hidden) {
  display: flex !important;
}
.modal-backdrop > .modal-panel {
  margin: auto;
  flex-shrink: 0;
  max-height: min(92vh, 900px);
}

@keyframes modal-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-panel {
  width: min(920px, 100%);
  max-height: min(90vh, 860px);
  background: var(--paper);
  border: 0;
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(50, 15, 13, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-panel-in 0.25s var(--ease-out);
}

.modal-panel-wide {
  width: min(1040px, 100%);
  max-height: min(92vh, 900px);
}
.modal-panel-sm {
  width: min(480px, 100%);
  max-height: min(88vh, 720px);
}
.system-status-modal-body {
  overflow: auto;
}
.modal-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.modal-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.create-modal-form .form-row {
  gap: 10px 12px;
}

.create-modal-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.create-modal-form label.span-2 {
  grid-column: 1 / -1;
}

.create-modal-form input,
.create-modal-form select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-weight: 400;
  background: #fff;
}

.create-modal-form input:focus,
.create-modal-form select:focus {
  outline: none;
  border-color: rgba(217, 52, 43, 0.4);
  box-shadow: 0 0 0 3px rgba(217, 52, 43, 0.08);
}

.create-modal-form .store-id-row {
  display: flex;
  align-items: stretch;
}

.create-modal-form .store-id-prefix {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  background: #f9fafb;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.create-modal-form .store-id-row input {
  border-radius: 0 10px 10px 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.modal-actions .primary,
.modal-actions .ghost {
  width: auto;
  margin-top: 0;
  min-width: 108px;
}

@keyframes modal-panel-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.modal-head h2 {
  margin: 0;
  font-size: 20px;
}

.modal-close,
button.ghost.modal-close {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  border-radius: 50% !important;
  border: 0 !important;
  background: var(--tint) !important;
  color: var(--brand-dark);
  box-shadow: none !important;
  transition: transform 0.15s ease, background 0.15s ease;
}

.modal-close:hover,
button.ghost.modal-close:hover {
  background: var(--tint-strong) !important;
  transform: rotate(5deg) scale(1.06);
}

.modal-body {
  padding: 20px;
  overflow: auto;
}

body.modal-open {
  overflow: hidden;
}

.bank-picker-field {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.bank-dropdown {
  position: relative;
}

.bank-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 12px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: none;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.bank-dropdown-trigger:hover {
  border-color: color-mix(in srgb, var(--brand) 30%, var(--line));
  transform: none;
  box-shadow: none;
}

.bank-dropdown.is-open .bank-dropdown-trigger {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent);
}

.bank-dropdown-trigger-inner {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.bank-dropdown-trigger-inner img {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.bank-dropdown-trigger-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bank-dropdown-trigger-text .bank-picker-name {
  font-size: 14px;
}

.bank-dropdown-placeholder {
  color: var(--muted);
  font-size: 14px;
}

.bank-dropdown-chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.2s;
}

.bank-dropdown.is-open .bank-dropdown-chevron {
  transform: rotate(180deg);
}

.bank-dropdown-panel {
  position: absolute;
  z-index: 120;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
}

.bank-dropdown-panel.hidden {
  display: none !important;
}

.bank-picker-field .field-label {
  font-size: 13px;
  font-weight: 600;
}

.bank-picker-scroll {
  max-height: min(48vh, 360px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  background: #fafafa;
}

.bank-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bank-picker-group {
  margin: 8px 0 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.bank-picker-group:first-child {
  margin-top: 0;
}

.bank-picker-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: none;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.bank-picker-item:hover {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--line));
  transform: none;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.bank-picker-item.is-selected {
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 6%, #fff);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 18%, transparent);
}


.bank-picker-logos {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}

.bank-picker-logos > img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  padding: 2px;
  box-sizing: border-box;
}

.bank-dropdown-trigger-inner .bank-picker-logos {
  width: 36px;
  height: 36px;
}

.bank-dropdown-trigger-inner .bank-picker-logos > img {
  width: 36px;
  height: 36px;
}

.bank-picker-pp-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #003d7a;
  background: #e8f0fa;
  border-radius: 6px;
  padding: 1px 6px;
  letter-spacing: 0;
  text-transform: none;
}

.bank-picker-item--promptpay .bank-picker-name {
  font-weight: 700;
}

.bank-picker-item img {
  flex-shrink: 0;
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  padding: 2px;
  box-sizing: border-box;
}

.bank-picker-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.bank-picker-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  color: var(--ink);
}

.bank-picker-meta {
  display: block;
  font-size: 11px;
  line-height: 1.35;
  text-align: left;
  color: var(--muted);
}

.bank-picker-meta code {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink);
  background: #f3f4f6;
  padding: 1px 4px;
  border-radius: 4px;
}

.bank-picker-hex {
  font-family: ui-monospace, monospace;
  font-size: 8px;
}

.bank-picker-other {
  display: grid;
  gap: 6px;
  margin: 0;
}

.bank-picker-other.hidden {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .login-card { animation: none; }
  .gate::before, .gate::after { display: none; }
}

@media (max-width: 900px) {
  .modal-panel-detail { width: 100%; max-height: 94vh; }
}

.store-actions{display:flex;gap:6px;justify-content:flex-end;align-items:center;flex-wrap:wrap}
.btn-delete-store{border:1px solid #f0c2bc;background:#fff5f4;color:#a93226;border-radius:999px;padding:8px 12px;font-size:12px;font-weight:700;cursor:pointer}
.btn-delete-store:hover{background:#fdecea;border-color:#e39b92}
.danger-button-delete-store{margin-top:10px;width:100%;background:#7b1e1a}
.danger-button-delete-store:hover{background:#5f1512}
.danger-delete-note{margin:8px 0 0;color:#a93226}

/* Whether a shop was actually warned its package is running out. ไม่ถึง means the
   email never arrived and somebody has to call them — it was invisible before. */
.date-cell .alert-ok { display: block; color: #2f8f57; font-size: 10px; margin-top: 2px }
.date-cell .alert-fail { display: block; color: #c0392b; font-weight: 700; font-size: 10px; margin-top: 2px }
.date-cell .alert-unknown { display: block; color: #8a8a8a; font-size: 10px; margin-top: 2px }

/* Two shops sharing an admin account: either password opens both, which is how one
   shop's bills and customers end up in another's books. */
.date-cell .admin-shared { display: block; color: #b45309; font-weight: 700; font-size: 10px; margin-top: 2px }
