:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #eef3f7;
  --ink: #18212f;
  --muted: #637083;
  --line: #d8dee7;
  --brand: #146b8c;
  --brand-strong: #0c506a;
  --accent: #d96b43;
  --success: #24754d;
  --danger: #b63535;
  --shadow: 0 20px 55px rgba(26, 37, 52, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell.locked {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

.sidebar {
  background: #16232d;
  color: #f7fbfd;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.25rem;
}

.brand-mark,
.lock-logo {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
}

.antler {
  fill: none;
  stroke: #e6c47a;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ear,
.face {
  fill: #7b8796;
  stroke: #f7fbfd;
  stroke-width: 3;
}

.muzzle {
  fill: #eef3f7;
}

.eye,
.nose {
  fill: #18212f;
}

.nav-section {
  display: grid;
  gap: 8px;
}

.section-title {
  color: #9cb1c2;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  padding: 0 10px;
}

.nav-item,
.folder-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: #d9e5ee;
  border-radius: 8px;
  min-height: 42px;
  padding: 9px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
}

.nav-item:hover,
.folder-button:hover,
.nav-item.active,
.folder-button.active {
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
}

.nav-item strong {
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.14);
  padding: 2px 7px;
  border-radius: 999px;
}

.folder-list {
  display: grid;
  gap: 5px;
}

.workspace {
  min-width: 0;
  padding: 28px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 18px;
}

.topbar,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  line-height: 1.08;
}

.top-actions,
.dialog-actions,
.generated-output {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button,
.ghost-button,
.icon-button {
  border-radius: 8px;
  min-height: 40px;
  border: 1px solid transparent;
  padding: 0 15px;
  font-weight: 750;
}

.primary-button {
  background: var(--brand);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--brand-strong);
}

.ghost-button {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
}

.ghost-button:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.icon-button {
  width: 42px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
  font-size: 1.25rem;
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.search-box {
  flex: 1;
  display: grid;
  gap: 4px;
}

label span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 107, 140, 0.13);
}

.content-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 430px) minmax(0, 1fr);
  gap: 18px;
}

.items-pane,
.detail-pane {
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.items-list {
  height: 100%;
  overflow: auto;
  display: grid;
  align-content: start;
}

.item-row {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  min-height: 82px;
  padding: 13px 16px;
  display: grid;
  gap: 5px;
  text-align: left;
  color: var(--ink);
}

.item-row:hover,
.item-row.active {
  background: #edf6f8;
}

.item-title-line,
.detail-title-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-name {
  font-weight: 800;
}

.item-meta,
.item-sub {
  color: var(--muted);
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.76rem;
  font-weight: 800;
  background: var(--panel-soft);
  color: var(--brand-strong);
}

.detail-pane {
  padding: 22px;
  overflow: auto;
}

.detail-header {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field-list {
  display: grid;
  gap: 12px;
}

.field {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.field-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 7px;
}

.field-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  overflow-wrap: anywhere;
}

.empty-state,
.empty-list {
  min-height: 360px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.empty-state svg {
  width: 92px;
  height: 92px;
  color: var(--brand);
}

.empty-state h2,
.empty-list h2 {
  color: var(--ink);
  margin-bottom: 0;
}

.lock-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(246, 247, 249, 0.86);
  backdrop-filter: blur(10px);
}

.lock-screen.hidden {
  display: none;
}

.lock-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 30px;
}

.lock-logo {
  margin-bottom: 12px;
}

.unlock-form,
.dialog-form {
  display: grid;
  gap: 16px;
}

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

dialog {
  width: min(720px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(14, 24, 34, 0.5);
}

.dialog-form {
  padding: 22px;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.dialog-header h2 {
  margin: 0;
}

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

.check-row,
.options-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input,
.options-grid input {
  width: auto;
}

.generated-output input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.user-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  display: grid;
  gap: 2px;
}

.user-name {
  font-weight: 800;
  color: #ffffff;
  font-size: 0.95rem;
}

.user-role {
  color: #9cb1c2;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 800;
}

.account-section,
.admin-section {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 12px;
}

.view {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 18px;
  min-height: 0;
}

.view[hidden] {
  display: none;
}

.admin-table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.admin-table th {
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.account-grid {
  display: grid;
  gap: 18px;
}

.account-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  display: grid;
  gap: 14px;
  max-width: 520px;
}

.qr-wrap {
  display: grid;
  place-items: center;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr-wrap img {
  width: 220px;
  height: 220px;
}

.secret-line code {
  background: var(--panel-soft);
  padding: 4px 8px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.muted.small {
  font-size: 0.85rem;
}

.auth-pane {
  display: grid;
  gap: 14px;
}

.auth-pane[hidden] {
  display: none;
}

.auth-pane h2 {
  margin: 0;
}

.ghost-button.danger {
  color: var(--danger);
  border-color: rgba(182, 53, 53, 0.4);
}

.ghost-button.danger:hover {
  color: #ffffff;
  background: var(--danger);
  border-color: var(--danger);
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .detail-pane {
    min-height: 420px;
  }
}

@media (max-width: 620px) {
  .workspace {
    padding: 18px;
  }

  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .toolbar .ghost-button {
    width: 100%;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }

  .form-row,
  .options-grid {
    grid-template-columns: 1fr;
  }
}
