:root {
  color-scheme: light;
  --canvas: #f4f6fa;
  --surface: #fff;
  --ink: #17243a;
  --muted: #52627a;
  --line: #dce3ec;
  --strong-line: #a5b3c5;
  --primary: #1f54bd;
  --primary-hover: #18469e;
  --danger: #a02532;
  --green: #12653e;
  --green-bg: #e6f5ed;
  --key-font: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--canvas);
  color: var(--ink);
  scrollbar-color: #a5b3c5 var(--canvas);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
::selection { background: #d8e6ff; color: #10254d; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
body { margin: 0; font-size: 15px; line-height: 1.5; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.55rem, 3.5vw, 2rem); letter-spacing: -0.03em; line-height: 1.25; }
h2 { font-size: 1.06rem; letter-spacing: -0.02em; line-height: 1.35; }

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--strong-line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  caret-color: var(--primary);
}
input::placeholder { color: var(--muted); }
input[aria-invalid="true"] { border-color: var(--danger); }
label { display: block; margin-bottom: 6px; font-size: .85rem; font-weight: 650; }

.workspace { max-width: 1112px; margin: 0 auto; padding: 56px 24px 48px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(285px, 318px); align-items: start; gap: 18px; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.panel-header { display: flex; align-items: center; gap: 8px; padding: 17px 20px; }
.count { color: var(--muted); font-size: .83rem; font-variant-numeric: tabular-nums; }
.list-state { padding: 24px 20px; color: var(--muted); border-top: 1px solid var(--line); }
.list-message { padding: 9px 20px 13px; color: var(--muted); font-size: .83rem; }
.list-message:empty { display: none; }
.list-message.is-error { color: var(--danger); }

table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { border-top: 1px solid var(--line); padding: 9px 12px; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
th { color: var(--muted); font-size: .79rem; font-weight: 650; }
.actions-heading { text-align: right; }
.key-value { font: 600 .96rem var(--key-font); white-space: nowrap; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 99px;
  background: #edf1f6;
  color: #495b73;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.active { color: var(--green); background: var(--green-bg); }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}
.icon-button:hover { background: #eaf1fc; color: var(--primary); }
.icon-button.delete:hover { background: #fbeef0; color: var(--danger); }
.icon-button.bordered { width: 44px; height: 44px; border-color: var(--strong-line); }
.icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.editor { padding: 18px 20px 20px; }
.editor h2 { margin-bottom: 18px; }
.key-field { display: flex; gap: 8px; }
.key-field input { font-family: var(--key-font); font-size: 16px; }
.key-field input::placeholder { font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; font-size: .88rem; }
.hint { margin-top: 8px; color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
.form-actions { display: flex; gap: 8px; margin-top: 18px; }
.primary, .secondary { min-height: 40px; padding: 8px 13px; border: 1px solid transparent; border-radius: 8px; font-size: .86rem; font-weight: 700; white-space: nowrap; }
.primary { background: var(--primary); color: #fff; }
.primary:hover { background: var(--primary-hover); }
.secondary { background: var(--surface); color: var(--ink); border-color: var(--strong-line); }
.secondary:hover { background: #eef3fa; }
.form-error { margin-top: 8px; color: var(--danger); font-size: .84rem; overflow-wrap: anywhere; }

.signin { width: min(100% - 32px, 400px); margin: clamp(48px, 14vh, 124px) auto 40px; }
.subheading { margin: 8px 0 20px; color: var(--muted); }
.signin-form { display: grid; gap: 16px; padding: 24px; }
.signin-form input { font-size: 16px; }
.signin-form .form-error { margin-top: 0; }

@media (max-width: 760px) {
  .workspace { padding-top: 32px; }
  .layout { grid-template-columns: 1fr; }
  .editor { max-width: 420px; width: 100%; }
}

@media (max-width: 470px) {
  .workspace { padding: 24px 12px 28px; }
  .page-header { gap: 8px; margin-bottom: 18px; }
  .panel-header { padding-inline: 12px; }
  .editor { padding-inline: 14px; }
  th, td { padding: 8px 5px; }
  th:first-child, td:first-child { padding-left: 10px; }
  th:last-child, td:last-child { padding-right: 6px; }
  .key-value { font-size: .82rem; }
  .status { padding: 3px 5px; gap: 4px; }
  .icon-button:not(.bordered) { width: 32px; height: 40px; }
  .row-actions { gap: 0; }
}
