:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #12161c;
  color: #f5f1e8;
  --surface: #1b222c;
  --edge: #364253;
  --muted: #aeb9c9;
  --gold: #efc479;
  --green: #a9dbc0;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: grid; grid-template-columns: 225px minmax(0, 1fr); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .52; cursor: default; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.sidebar { background: #171d26; border-right: 1px solid var(--edge); padding: 24px 16px; display: flex; flex-direction: column; gap: 34px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand span { display: grid; place-items: center; color: var(--gold); border: 1px solid var(--gold); border-radius: 12px; width: 40px; height: 40px; font-weight: 800; }
.brand small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
nav { display: grid; gap: 7px; }
nav button { border: 1px solid transparent; background: none; color: var(--muted); text-align: left; border-radius: 9px; padding: 11px; }
nav button[aria-current] { border-color: #6b5637; background: #30291e; color: var(--gold); }
.sidebar-note { margin: auto 0 0; color: var(--muted); font-size: .8rem; }
main { min-width: 0; width: 100%; max-width: 1450px; padding: clamp(20px, 4vw, 48px); margin: 0 auto; }
header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
h1 { margin: 0; font-size: clamp(1.9rem, 4vw, 2.6rem); letter-spacing: -.035em; }
h2 { margin: 0 0 12px; font-size: 1.12rem; }
header p, .muted { color: var(--muted); }
header p { margin: 6px 0 0; }
.notice { background: #232829; color: #e6ddc7; border: 1px solid #515141; border-radius: 10px; padding: 12px 14px; margin: 23px 0; }
.panel { background: var(--surface); border: 1px solid var(--edge); border-radius: 15px; padding: 21px; min-width: 0; }
.app-grid, .operation { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.operation { grid-template-columns: minmax(235px, .8fr) minmax(0, 1.2fr); }
.url, dd { overflow-wrap: anywhere; color: #eac98d; }
dl { margin: 15px 0; } dt { color: var(--muted); font-size: .83rem; } dd { margin: 4px 0 13px; }
label { display: block; margin: 13px 0 6px; font-size: .91rem; }
input, select { width: 100%; padding: 10px 11px; border: 1px solid #495970; border-radius: 8px; background: #131922; color: inherit; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.primary, .secondary { padding: 9px 13px; border-radius: 8px; min-height: 39px; font-weight: 650; }
.primary { border: 1px solid var(--gold); background: var(--gold); color: #231b10; }
.secondary { border: 1px solid #536276; color: inherit; background: #202a37; }
.checks { list-style: none; padding: 0; }
.checks li, .mirror { padding: 10px 0; border-top: 1px solid var(--edge); overflow-wrap: anywhere; }
.checks li strong, .mirror strong { display: block; }
.checks li.pass strong { color: var(--green); }
.checks li.fail strong { color: #ffc0ac; }
#commit button { margin-top: 9px; }
.table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.table th, .table td { padding: 9px; border-bottom: 1px solid var(--edge); text-align: left; overflow-wrap: anywhere; }
.table th { color: var(--muted); }
.table-shell { overflow-x: auto; }
@media (max-width: 950px) { .operation, .app-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  body { display: block; }
  .sidebar { padding: 12px 16px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--edge); }
  nav { grid-template-columns: repeat(3, minmax(0, 1fr)); } nav button { text-align: center; }
  .sidebar-note { display: none; }
  header { align-items: flex-start; flex-direction: column; }
  .panel { padding: 16px; }
}

main { max-width: 1520px; padding: clamp(20px, 3.8vw, 60px); }
body { background: #10151b; font-family: "Segoe UI", Arial, sans-serif; }
header { border-bottom: 1px solid var(--edge); padding-bottom: 22px; }
h1 { font-size: clamp(1.7rem, 3vw, 2.35rem); }
.notice { border: 0; background: transparent; padding: 0; margin: 15px 0 26px; color: var(--muted); font-size: .88rem; }
.app-grid { display: block; border: 1px solid var(--edge); background: var(--surface); border-radius: 12px; }
.inventory-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.inventory-toolbar h2 { margin: 0; }
.panel-filter { display: flex; align-items: center; gap: 10px; max-width: 100%; }
.panel-filter label { margin: 0; color: var(--muted); }
.panel-filter select { width: auto; max-width: 100%; }
.app-row { display: grid; grid-template-columns: 1fr 1.1fr 1fr auto; align-items: start; gap: 20px; padding: 20px; }
.app-row:not([hidden]) ~ .app-row { border-top: 1px solid var(--edge); }
.app-row h3 { margin: 0 0 4px; font-size: 1rem; }
.app-row small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.route strong { display: block; margin-top: 4px; font-weight: 550; overflow-wrap: anywhere; }
.origin-status { margin-top: 10px; font-size: .83rem; }
.origin-status .pending { color: var(--gold); }
.down { color: #ffc0ac; }
summary { cursor: pointer; font-size: .88rem; padding: 8px 0; }
.synced { color: var(--green); }
.pending { color: var(--gold); }
.mirror-detail { color: var(--muted); font-size: .83rem; overflow-wrap: anywhere; margin: 8px 0; }
.mirror-detail strong { color: var(--text); display: block; }
#overview { margin-bottom: 24px; }
.operation { align-items: start; }
.operation .panel:first-child { border-top: 2px solid var(--gold); }
#preview-message { line-height: 1.5; }
@media (max-width: 1100px) { .app-row { grid-template-columns: 1fr 1fr; } .app-row button { justify-self: start; } }
@media (max-width: 480px) { .app-row { grid-template-columns: 1fr; gap: 8px; } }

.login-layout {
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 0, #2c251d, #10151b 60%);
}
.login-card {
  max-width: 456px;
  width: 100%;
  margin: 0;
  padding: clamp(22px, 5vw, 38px);
  border-top: 2px solid var(--gold);
}
.login-card h1 { margin-top: 24px; font-size: clamp(1.55rem, 5vw, 2rem); }
.login-card > p { margin: 8px 0 24px; }
.login-card button[type="submit"] { width: 100%; }
.password-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.account-form { max-width: 530px; }
.reseller-apps { margin: 16px 0; padding: 8px 12px; border: 1px solid var(--edge); border-radius: 8px; }
.reseller-apps label { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.reseller-apps input { width: auto; }
.reseller-entry { padding: 10px 0; border-top: 1px solid var(--edge); overflow-wrap: anywhere; }
.reseller-entry p { margin: 4px 0; font-size: .88rem; }
.reseller-entry button { margin-top: 8px; }
#provision-dialog { width: min(480px, calc(100% - 32px)); color: inherit; }
#provision-dialog::backdrop { background: rgb(12 15 20 / 77%); }
#provision-status:empty { display: none; }
#auth-message { color: #ffd7a3; font-size: .9rem; }
#auth-message:empty { margin: 0 0 16px; }
.sign-out { margin-top: auto; }
@media (max-width: 640px) {
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sign-out { align-self: flex-start; }
}
