:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #202124;
  --muted: #687076;
  --line: #d9dedb;
  --accent: #167d7f;
  --accent-dark: #0f5f61;
  --danger: #b42318;
  --warn: #a15c07;
  --ok: #137333;
  --shadow: 0 18px 42px rgba(32, 33, 36, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

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

.app-shell {
  min-height: 100vh;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.brand h1,
.login-panel h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.brand p,
.login-panel p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}

.sidebar {
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: #fbfaf7;
}

.nav-button {
  width: 100%;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  margin-bottom: 6px;
}

.nav-button.active,
.nav-button:hover {
  background: #e5f1f1;
  color: var(--accent-dark);
}

.content {
  padding: 28px;
  min-width: 0;
}

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

.page-head h2 {
  margin: 0;
  font-size: 24px;
}

.page-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  align-items: start;
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(32, 33, 36, 0.05);
}

.panel {
  padding: 20px;
}

.panel h3 {
  margin: 0 0 16px;
  font-size: 17px;
}

.form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 13px;
  color: #3f474c;
}

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

.field textarea {
  min-height: 82px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22, 125, 127, 0.14);
}

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

.btn {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #ecefed;
  color: var(--ink);
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  background: var(--accent-dark);
}

.btn.danger {
  background: #fce8e6;
  color: var(--danger);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf2f7;
  color: #344054;
  font-size: 12px;
}

.badge.ok {
  background: #e6f4ea;
  color: var(--ok);
}

.badge.warn {
  background: #fef0c7;
  color: var(--warn);
}

.muted {
  color: var(--muted);
}

.code-card {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.code-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.secret-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.secret-mask {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.password-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

.otp {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 6px;
  font-variant-numeric: tabular-nums;
}

.timer {
  height: 8px;
  border-radius: 999px;
  background: #edf0ee;
  overflow: hidden;
}

.timer span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s linear;
}

.account-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.account-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.account-title h3 {
  margin: 0;
  font-size: 17px;
}

.account-title p {
  margin: 5px 0 0;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 15px;
  border-radius: 8px;
  color: #fff;
  background: #263238;
  box-shadow: var(--shadow);
  z-index: 99;
}

.empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

.checkbox-grid {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.check-row input {
  width: auto;
}

@media (max-width: 820px) {
  .topbar {
    height: auto;
    padding: 14px 16px;
    align-items: flex-start;
  }

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

  .sidebar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
  }

  .nav-button {
    width: auto;
    white-space: nowrap;
    margin: 0;
  }

  .content {
    padding: 18px;
  }

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

  .page-head {
    display: grid;
  }

  .otp {
    font-size: 28px;
    letter-spacing: 4px;
  }
}
