:root {
  color-scheme: dark;
  font-family: Poppins, system-ui, sans-serif;
  --bg: #0d0d0d;
  --surface: #1a1a1a;
  --card: #202020;
  --border: #343434;
  --orange: #ff6a00;
  --orange-light: #ff8a2b;
  --white: #fff;
  --muted: #b3b3b3;
  --green: #2ecc71;
  --red: #ff5e57;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--white); }
button, input { font: inherit; }
button { cursor: pointer; }
.login-shell { width: min(440px, calc(100% - 32px)); min-height: 100vh; margin: auto; display: flex; flex-direction: column; justify-content: center; }
.brand-mark { width: 58px; height: 58px; display: block; flex: none; border-radius: 18px; padding: 8px; background: linear-gradient(135deg, var(--orange), var(--orange-light)); }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.login-brand strong { display: block; font-size: 19px; }
.login-brand strong span, .brand span { color: var(--orange-light); }
.login-brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 14px; letter-spacing: .08em; }
.eyebrow { margin: 24px 0 4px; color: var(--orange-light); font-size: 14px; font-weight: 700; letter-spacing: .12em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(25px, 4vw, 34px); }
.muted, .security-note { color: var(--muted); font-size: 14px; line-height: 1.6; }
.form-card { margin-top: 24px; padding: 22px; border: 1px solid var(--border); border-radius: 24px; background: var(--surface); display: grid; gap: 12px; }
.login-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
label { color: var(--muted); font-size: 14px; }
input { width: 100%; min-height: 48px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg); color: var(--white); padding: 0 14px; outline: none; }
input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px #ff6a0028; }
.button { min-height: 46px; border: 0; border-radius: 999px; padding: 0 18px; color: var(--white); font-weight: 600; }
.button.primary { background: linear-gradient(100deg, var(--orange), var(--orange-light)); }
.button.secondary { background: #292929; border: 1px solid var(--border); }
.button.danger { color: #ffd8d5; background: #54221f; border: 1px solid #833a35; }
.button:disabled { opacity: .55; cursor: wait; }
.error { min-height: 18px; margin: 0; color: var(--red); font-size: 14px; }
.security-note { margin-top: 18px; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
aside { padding: 26px 18px; border-right: 1px solid var(--border); background: #111; }
.brand { display: flex; gap: 12px; align-items: center; margin: 0 8px 32px; }
.brand .brand-mark { width: 44px; height: 44px; border-radius: 14px; padding: 6px; }
.brand strong { display: block; font-size: 16px; }
.brand span { color: var(--orange-light); }
.brand small { color: var(--muted); font-size: 14px; }
nav { display: grid; gap: 8px; }
nav button { min-height: 48px; border: 1px solid transparent; border-radius: 14px; padding: 0 14px; background: transparent; color: var(--muted); text-align: left; font-size: 14px; }
nav button[aria-current="page"] { color: var(--white); border-color: #5c2f13; background: #2a1b12; }
.side-bottom { margin-top: 36px; padding: 0 8px; }
.content { min-width: 0; padding: 28px clamp(16px, 3vw, 40px); }
.topbar { display: flex; gap: 18px; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.topbar h1 { margin: 0; font-size: clamp(23px, 3vw, 30px); }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric, .panel { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); }
.metric span { color: var(--muted); font-size: 14px; }
.metric strong { display: block; margin-top: 8px; font-size: 24px; }
.panel { margin-bottom: 18px; }
.panel h2 { margin-bottom: 14px; font-size: 17px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; font-size: 14px; }
th { color: var(--muted); font-weight: 500; }
td .sub { display: block; margin-top: 3px; color: var(--muted); font-size: 14px; }
td .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.application-details { max-width: 430px; margin-top: 9px; color: var(--muted); font-size: 14px; }
.application-details summary { width: fit-content; color: var(--orange-light); cursor: pointer; }
.application-details dl { display: grid; gap: 6px; margin: 8px 0; }
.application-details dl div { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 8px; }
.application-details dt { color: var(--muted); }
.application-details dd { margin: 0; color: #eee; overflow-wrap: anywhere; }
.application-details a { color: var(--orange-light); }
td .button { min-height: 44px; padding: 0 13px; font-size: 14px; }
.badge { display: inline-flex; align-items: center; min-height: 28px; border-radius: 99px; padding: 0 10px; background: #303030; color: var(--muted); font-size: 14px; }
.badge.good { background: #153725; color: #a0eabf; }
.badge.warn { background: #3a2c16; color: #ffd782; }
.badge.bad { background: #44211f; color: #ffc1bc; }
.notice { padding: 12px 14px; border: 1px solid #5c2f13; border-radius: 14px; background: #21160f; color: #ffcfaa; font-size: 14px; }
.empty { padding: 22px 12px; color: var(--muted); text-align: center; font-size: 14px; }
.order-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.order-card { padding: 15px; border: 1px solid var(--border); border-radius: 16px; background: var(--card); }
.order-card strong { display: block; margin-bottom: 5px; font-size: 14px; }
.order-card p { margin: 5px 0; color: var(--muted); font-size: 14px; }
.order-actions { margin-top: 12px; }
.order-actions .button { min-height: 44px; font-size: 14px; }
.receipt-dialog { width: min(900px, calc(100% - 24px)); max-width: 900px; max-height: calc(100vh - 24px); padding: 0; overflow: auto; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--white); box-shadow: 0 18px 60px #000a; }
.receipt-dialog::backdrop { background: #000b; }
.receipt-viewer { display: grid; justify-items: center; gap: 14px; padding: 16px; }
.receipt-viewer header { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.receipt-viewer h2 { margin: 0; font-size: 17px; }
.receipt-viewer img { display: block; max-width: 100%; max-height: 74vh; object-fit: contain; border-radius: 12px; background: #0d0d0d; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.toolbar input { max-width: 340px; }
.support-layout { min-width: 0; display: grid; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.5fr); gap: 16px; min-height: min(720px, calc(100vh - 190px)); }
.support-list, .support-thread { display: flex; flex-direction: column; min-height: 0; margin: 0; }
.support-list { padding: 14px; }
.support-list-heading { padding: 4px 4px 12px; }
.support-list-heading h2, .support-thread-heading h2 { margin: 0 0 4px; font-size: 17px; }
.support-list-heading p, .support-thread-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.support-conversations { overflow: auto; display: grid; gap: 8px; }
.support-conversation { width: 100%; min-height: 88px; border: 1px solid var(--border); border-radius: 15px; padding: 12px; background: #151515; color: var(--white); text-align: left; }
.support-conversation:hover, .support-conversation:focus-visible { border-color: #8d471a; outline: none; }
.support-conversation.selected { border-color: var(--orange); background: #291a11; }
.support-conversation-top, .support-message-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.support-conversation-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.support-conversation-top span, .support-conversation-meta { color: var(--muted); font-size: 14px; white-space: nowrap; }
.support-conversation-meta { display: block; overflow: hidden; margin: 5px 0 8px; text-overflow: ellipsis; }
.support-conversation-last { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.support-conversation-last > span:first-child { overflow: hidden; color: #dedede; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.support-conversation-last .badge { flex: none; min-height: 24px; padding: 0 8px; font-size: 14px; }
.support-thread { padding: 0; overflow: hidden; }
.support-thread-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.support-messages { flex: 1; min-height: 220px; overflow: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 18px; }
.support-message { width: min(88%, 560px); padding: 11px 13px; border: 1px solid var(--border); border-radius: 15px 15px 15px 4px; background: #171717; overflow-wrap: anywhere; }
.support-message.from-admin { align-self: flex-end; border-color: #70401f; border-radius: 15px 15px 4px 15px; background: #2a1b12; }
.support-message-head strong { font-size: 14px; font-weight: 600; }
.support-message-head time { color: var(--muted); font-size: 14px; }
.support-message p { margin: 7px 0 0; color: #f3f3f3; font-size: 14px; line-height: 1.55; white-space: pre-wrap; }
.support-compose { display: flex; align-items: flex-end; gap: 10px; padding: 12px; border-top: 1px solid var(--border); background: #151515; }
.support-compose textarea { flex: 1; min-height: 48px; max-height: 140px; resize: vertical; border: 1px solid var(--border); border-radius: 14px; padding: 12px; background: var(--bg); color: var(--white); font: inherit; font-size: 14px; }
.support-compose textarea:focus { border-color: var(--orange); outline: none; box-shadow: 0 0 0 3px #ff6a0028; }
.support-compose .button { flex: none; }
.support-thread > .error { padding: 0 14px 8px; }
.support-no-selection { display: grid; flex: 1; place-items: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: calc(100vw - 40px); padding: 14px 18px; border-radius: 14px; background: #26372d; color: #c0f0d1; box-shadow: 0 8px 26px #0008; font-size: 14px; }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  aside { padding: 14px; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { margin: 2px 4px 14px; }
  nav { display: flex; overflow-x: auto; }
  nav button { flex: 0 0 auto; }
  .side-bottom { position: absolute; right: 14px; top: 18px; margin: 0; }
  .side-bottom .muted { display: none; }
  .content { padding-top: 20px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .support-layout { grid-template-columns: 1fr; min-height: 0; }
  .support-list { max-height: 290px; }
  .support-conversations { max-height: 220px; }
  .support-thread { min-height: 60vh; }
}
@media (max-width: 460px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .metrics { gap: 9px; }
  .metric { padding: 14px; }
  .metric strong { font-size: 20px; }
  .support-compose { align-items: stretch; flex-direction: column; }
  .support-compose .button { width: 100%; }
}
