:root {
  color-scheme: light;
  --ink: #17211b;
  --muted: #66736b;
  --line: #dce4df;
  --surface: #ffffff;
  --soft: #f4f7f5;
  --green: #176b45;
  --green-soft: #e7f4ec;
  --amber: #8a5a00;
  --amber-soft: #fff5d8;
  --danger: #ae2f2f;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: #eef2ef; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.login-screen { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(circle at top, #e6f2eb, #eef2ef 45%); }
.login-card { display: grid; width: min(420px, 100%); gap: 16px; padding: 30px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 20px 55px #1737271f; }
.login-card h1 { margin: 0; font-size: 28px; }
.login-card > p:not(.eyebrow) { margin: -8px 0 4px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.login-card > small { color: var(--muted); text-align: center; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 22px max(24px, calc((100vw - 1120px) / 2)); background: #133a2a; color: white; }
.topbar h1 { margin: 2px 0 4px; font-size: 25px; }
.topbar p { margin: 0; color: #cce0d4; font-size: 13px; }
.account-box { display: grid; grid-template-columns: auto auto; align-items: center; gap: 2px 10px; font-size: 12px; text-align: right; }
.account-box b { color: #a8d1ba; }
.account-box .button { grid-column: 1 / -1; margin-top: 3px; }
.eyebrow { margin: 0; color: #5c7969; font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.topbar .eyebrow { color: #9fc7b0; }
.environment { padding: 7px 10px; border: 1px solid #547c69; border-radius: 999px; font-size: 12px; }
main { width: min(1120px, calc(100% - 48px)); margin: 22px auto 60px; }
.connection-strip { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px 12px 0 0; background: white; }
.connection { padding: 5px 8px; border-radius: 999px; font-size: 12px; font-weight: 750; }
.connection.ok { color: var(--green); background: var(--green-soft); }
.connection.warning { color: var(--amber); background: var(--amber-soft); }
.connection-help { margin: 0; padding: 10px 13px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 12px 12px; color: var(--muted); background: #f9fbfa; font-size: 12px; }
.notice { display: flex; align-items: center; gap: 13px; padding: 14px 16px; border: 1px solid #ead79c; border-radius: 12px; background: var(--amber-soft); }
.notice-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; background: #f3df9d; color: var(--amber); font-weight: 900; }
.notice p, .section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 24px 0 10px; }
.section-heading.compact { margin-top: 0; }
.section-heading h2 { margin: 0; font-size: 18px; }
.status { min-height: 20px; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.plan-list { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.plan-row { display: grid; grid-template-columns: minmax(160px, 1.2fr) 110px 100px 110px minmax(220px, 1.5fr) 88px; align-items: center; gap: 14px; min-height: 82px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.plan-row:last-child { border-bottom: 0; }
.plan-name { margin: 0 0 3px; font-size: 16px; }
.plan-description, .cell-label { color: var(--muted); font-size: 12px; }
.cell-value { display: block; margin-top: 3px; font-size: 14px; font-weight: 750; }
.badge { display: inline-flex; align-items: center; gap: 5px; width: fit-content; padding: 5px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge.active { color: var(--green); background: var(--green-soft); }
.badge.inactive { color: var(--amber); background: var(--amber-soft); }
.button { min-height: 34px; padding: 7px 12px; border: 0; border-radius: 8px; font-weight: 750; }
.button.primary { color: white; background: var(--green); }
.button.secondary { border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
.button.ghost { border: 1px solid #557966; color: white; background: transparent; }
.button.danger { color: white; background: var(--danger); }
.button.wide { width: 100%; }
.button.small { min-height: 30px; padding: 5px 9px; font-size: 12px; }
.table-card { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: white; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 10px 12px; color: var(--muted); background: var(--soft); font-size: 11px; text-align: left; white-space: nowrap; }
td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 450; }
.badge.license-trial { color: #3b5f90; background: #e9f0fb; }
.badge.license-paid { color: var(--green); background: var(--green-soft); }
.badge.license-suspended, .badge.license-expired { color: var(--danger); background: #fdecec; }
.device-list { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: white; }
.device-row { display: grid; grid-template-columns: 1.4fr 1fr 90px 1fr 100px 90px; gap: 12px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.device-row:last-child { border-bottom: 0; }
.audit-section { margin-top: 26px; }
.audit-list { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.audit-item { display: grid; grid-template-columns: 145px 150px 1fr; gap: 14px; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.audit-item:last-child { border-bottom: 0; }
.audit-item time, .audit-item span { color: var(--muted); }
.empty { padding: 18px; margin: 0; color: var(--muted); text-align: center; }
.drawer { position: fixed; z-index: 30; top: 0; right: 0; width: min(540px, 100vw); height: 100vh; padding: 22px; overflow-y: auto; background: var(--surface); box-shadow: -18px 0 40px #102a1c26; transform: translateX(104%); transition: transform .18s ease; }
.drawer.open { transform: translateX(0); }
.drawer-header { display: flex; justify-content: space-between; align-items: start; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.drawer-header h2 { margin: 3px 0 0; font-size: 22px; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 23px; line-height: 1; }
.backdrop { position: fixed; z-index: 20; inset: 0; background: #10251b73; }
fieldset { display: grid; gap: 13px; margin: 18px 0; padding: 0 0 18px; border: 0; border-bottom: 1px solid var(--line); }
legend { margin-bottom: 12px; font-size: 14px; font-weight: 850; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 750; }
label small, fieldset > small { color: var(--muted); font-size: 11px; font-weight: 450; line-height: 1.45; }
input:not([type="checkbox"]), textarea, select { width: 100%; padding: 9px 10px; border: 1px solid #bcc9c1; border-radius: 8px; color: var(--ink); background: white; }
input:focus, textarea:focus { outline: 3px solid #9ac9ae75; border-color: var(--green); }
input[readonly] { color: #5c675f; background: var(--soft); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.switch-row { grid-template-columns: 1fr auto auto auto; align-items: center; gap: 9px; padding: 11px; border-radius: 9px; background: var(--soft); }
.switch-row > input { position: absolute; opacity: 0; }
.switch { position: relative; width: 38px; height: 22px; border-radius: 999px; background: #aab4ae; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: white; transition: .15s; }
.switch-row input:checked + .switch { background: var(--green); }
.switch-row input:checked + .switch::after { transform: translateX(16px); }
.feature-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check-row { display: flex; align-items: center; gap: 7px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.form-error { min-height: 19px; color: var(--danger); font-size: 12px; font-weight: 700; }
.drawer-actions, .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
dialog { width: min(500px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 14px; box-shadow: 0 22px 70px #10251b4d; }
dialog::backdrop { background: #10251b73; }
.review-card { padding: 22px; }
.review-card h2 { margin: 4px 0; font-size: 22px; }
.review-help { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.change-list { margin: 0 0 17px; border: 1px solid var(--line); border-radius: 9px; }
.change-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 9px 11px; border-bottom: 1px solid var(--line); font-size: 13px; }
.change-row:last-child { border-bottom: 0; }
.change-row dt { color: var(--muted); }
.change-row dd { margin: 0; font-weight: 750; }
.inline-input { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
.danger-note { margin: 14px 0; padding: 11px; border: 1px solid #e6b6b6; border-radius: 9px; color: var(--danger); background: #fff1f1; font-size: 13px; font-weight: 750; }
.license-key { display: block; padding: 14px; border: 1px dashed #7a9686; border-radius: 9px; background: var(--soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; font-weight: 800; overflow-wrap: anywhere; user-select: all; }

@media (max-width: 850px) {
  .plan-row { grid-template-columns: 1fr 1fr 1fr; }
  .plan-row .plan-main { grid-column: 1 / 3; }
  main { width: min(100% - 24px, 1120px); }
}

@media (max-width: 560px) {
  .topbar { padding: 18px 14px; }
  .environment { display: none; }
  .plan-row { grid-template-columns: 1fr 1fr; }
  .plan-row .plan-main { grid-column: 1 / -1; }
  .field-grid, .feature-list { grid-template-columns: 1fr; }
  .audit-item { grid-template-columns: 1fr; gap: 3px; }
  .device-row { grid-template-columns: 1fr 1fr; }
}
