:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #667085;
  --line: #d8dde8;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --shadow: 0 16px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  padding: 0 16px;
  font-weight: 650;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

button.secondary {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line);
}

button.secondary:hover {
  background: #f1f5f9;
}

button.danger {
  width: fit-content;
  background: var(--danger-bg);
  border-color: #f3b8b1;
  color: var(--danger);
}

button.danger:hover {
  background: #ffe4e0;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.auth-panel {
  width: min(520px, 100%);
  margin: 12vh auto 0;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 34px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

.muted,
.panel-heading p,
small {
  color: var(--muted);
}

.login-form {
  margin-top: 28px;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 8px;
}

label,
fieldset {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 14px;
  font-weight: 650;
}

input,
select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 12px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  outline-offset: 2px;
}

.error {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 14px;
}

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

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

.save-state {
  min-width: 104px;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

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

.panel {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.service-panel,
.store-panel {
  grid-column: 1 / -1;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.panel-heading p {
  margin-bottom: 0;
  text-align: right;
}

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

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #eef1f6;
}

.switch-row:last-child {
  border-bottom: 0;
}

.switch-row span {
  display: grid;
  gap: 4px;
}

.switch-row input {
  width: 48px;
  height: 26px;
  min-height: 26px;
  accent-color: var(--accent);
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}

legend {
  margin-bottom: 10px;
}

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

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
  font-size: 13px;
  font-weight: 600;
}

.checkbox-grid input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.pack-list {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfe;
}

.pack-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border-bottom: 1px solid #eef1f6;
  padding-bottom: 8px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.pack-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.pack-row button {
  min-height: 32px;
  padding: 0 10px;
}

.empty {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 780px) {
  .shell {
    width: min(100% - 24px, 1180px);
    padding: 20px 0;
  }

  .topbar,
  .panel-heading,
  .switch-row {
    display: grid;
  }

  .topbar-actions,
  .panel-heading p {
    justify-content: start;
    text-align: left;
  }

  .layout,
  .field-grid,
  .checkbox-grid,
  .password-row {
    grid-template-columns: 1fr;
  }
}
