:root {
  --bg: #f5f7f2;
  --surface: #ffffff;
  --surface-soft: #f9fbf5;
  --text: #17202a;
  --muted: #667085;
  --line: #dfe5d6;
  --primary: #99cc00;
  --primary-dark: #4f6e00;
  --primary-soft: #edf8c9;
  --nav: #111827;
  --nav-hover: #24301a;
  --info: #2563eb;
  --danger: #b42318;
  --warn: #b54708;
  --success: #067647;
  --shadow: 0 12px 28px rgba(17, 24, 39, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, Arial, sans-serif;
  line-height: 1.5;
}

a { color: var(--primary-dark); font-weight: 700; }
a:hover { color: #334700; }

.side {
  position: fixed;
  inset: 0 auto 0 0;
  width: 252px;
  background: var(--nav);
  color: #fff;
  padding: 20px 14px;
  border-right: 4px solid var(--primary);
}

.brand {
  min-height: 44px;
  margin: 0 8px 22px;
  color: #f9fafb;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}

.side a,
.nav-form button {
  display: block;
  width: 100%;
  margin: 4px 0;
  padding: 10px 12px;
  border-radius: 8px;
  color: #d0d5dd;
  text-align: left;
  text-decoration: none;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.side a:hover,
.nav-form button:hover {
  background: var(--nav-hover);
  color: #fff;
}

.nav-form { margin: 4px 0; }

.main {
  margin-left: 252px;
  padding: 28px;
}

.main.full {
  min-height: 100vh;
  margin-left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

h1 { margin: 0 0 18px; font-size: 28px; line-height: 1.2; }
h2, h3 { margin-top: 0; line-height: 1.25; }

.login {
  width: min(100%, 390px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 5px solid var(--primary);
  border-radius: 8px;
  padding: 30px;
  box-shadow: var(--shadow);
}

.card,
.stat,
.tablewrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.card { padding: 22px; margin-bottom: 20px; }
.narrow { max-width: 720px; }

.credential-card {
  max-width: 1180px;
  margin: 0 auto 20px;
  padding: 0;
  overflow: hidden;
}

.import-card {
  max-width: 920px;
  margin: 0 auto 20px;
  padding: 0;
  overflow: hidden;
}

.form-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfff0 100%);
  border-bottom: 1px solid var(--line);
}

.form-head h1 { margin-bottom: 6px; }
.form-head p { margin: 0; }

.credential-form { padding: 0 24px 24px; }

.form-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.form-section:last-of-type { border-bottom: 0; }

.form-section h3 {
  margin: 0 0 14px;
  color: #1f2937;
  font-size: 15px;
  text-transform: uppercase;
}

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

.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.secret-section {
  margin: 0 -24px;
  padding: 20px 24px;
  background: #fbfff0;
}

.secret-grid {
  grid-template-columns: minmax(0, 2fr) minmax(220px, .8fr);
  align-items: start;
}

.field-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.columns-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
  padding-left: 18px;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 20px;
}

.visually-compact { margin-bottom: 0; }

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat {
  padding: 18px;
  border-left: 5px solid var(--primary);
}

.stat b { display: block; font-size: 32px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 14px; }
.stat.danger b { color: var(--danger); }

label {
  display: block;
  margin: 0 0 14px;
  color: #344054;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 7px;
  padding: 10px 12px;
  border: 1px solid #cbd5c0;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea { min-height: 110px; resize: vertical; }

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
.btn:focus-visible {
  outline: 3px solid rgba(153, 204, 0, .35);
  outline-offset: 2px;
  border-color: var(--primary-dark);
}

button,
.btn {
  display: inline-block;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #182300;
  padding: 10px 16px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(79, 110, 0, .22);
}

button:hover,
.btn:hover { background: #aee600; color: #111800; }

.btn.secondary,
button.secondary {
  background: #475467;
  color: #fff;
  box-shadow: none;
}

.btn.secondary:hover,
button.secondary:hover { background: #344054; color: #fff; }

.dangerbtn {
  background: var(--danger);
  color: #fff;
  box-shadow: none;
}

.dangerbtn:hover { background: #8f1d14; color: #fff; }

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid transparent;
  font-weight: 700;
}

.alert.ok { background: #ecfdf3; color: var(--success); border-color: #abefc6; }
.alert.error { background: #fef3f2; color: var(--danger); border-color: #fecdca; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

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

.search {
  display: flex;
  gap: 10px;
  margin: 10px 0 18px;
}

.search input { margin: 0; }
.tablewrap { overflow: auto; }

table {
  width: 100%;
  min-width: 950px;
  border-collapse: collapse;
}

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

th {
  background: var(--surface-soft);
  color: #475467;
  font-size: 12px;
  text-transform: uppercase;
}

tr:hover td { background: #fcfff4; }

.pill,
.crit {
  display: inline-block;
  margin: 2px 0;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
}

.crit.critical { background: #fee4e2; color: var(--danger); }
.crit.high { background: #fef0c7; color: var(--warn); }
.crit.medium { background: #dbeafe; color: #1d4ed8; }
.crit.low { background: #dcfae6; color: var(--success); }

.masked {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: 2px;
}

.masked.big { font-size: 22px; }

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

.detail dl {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 12px 18px;
}

.detail dt {
  color: #344054;
  font-weight: 800;
}

.detail dd { margin: 0; min-width: 0; }

.inline2,
.password-row,
.password-reveal {
  display: flex;
  gap: 10px;
  align-items: end;
}

.inline2 { margin-top: 12px; }
.inline2 input { max-width: 260px; margin: 0; }
.password-row input,
.password-reveal input { margin-top: 7px; }
.password-row button,
.password-reveal button { white-space: nowrap; }

.shownpass {
  background: #f8fafc;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 16px;
}

.muted,
small {
  color: var(--muted);
  font-weight: 400;
}

small { display: block; margin-top: 5px; }

.secret {
  overflow: auto;
  background: #101828;
  color: #d7ff68;
  border-radius: 8px;
  padding: 16px;
}

.setup-card { max-width: 860px; }

.setup-qr-grid {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  margin-top: 18px;
}

.qr-panel {
  display: flex;
  justify-content: center;
  padding: 18px;
  background: #fbfff0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr-frame {
  padding: 10px;
  background: #fff;
  border: 1px solid #d9e8b1;
  border-radius: 8px;
}

.qr-code {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.verify-panel {
  padding: 18px;
  border-left: 4px solid var(--primary);
  background: #fff;
}

.manual-key {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.manual-key summary {
  color: var(--primary-dark);
  font-weight: 800;
  cursor: pointer;
}

.manual-key textarea {
  min-height: 80px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
}

pre { white-space: pre-wrap; overflow-wrap: anywhere; }

code {
  background: #eef2e6;
  border-radius: 6px;
  padding: 2px 5px;
}

.mini-form {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin: 3px;
}

.mini-form select {
  min-width: 125px;
  margin: 0;
  padding: 8px;
}

.mini-form button { min-height: 36px; padding: 8px 10px; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  background: #101828;
  color: #fff;
  padding: 12px 16px;
  border-left: 5px solid var(--primary);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  .side {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 4px solid var(--primary);
  }

  .main { margin-left: 0; padding: 20px; }
  .cards, .grid2 { grid-template-columns: 1fr; }
  .form-grid.cols-2, .form-grid.cols-3, .secret-grid, .setup-qr-grid, .columns-list { grid-template-columns: 1fr; }
  .credential-card, .import-card { margin: 0; }
  .credential-form, .form-head { padding-left: 18px; padding-right: 18px; }
  .secret-section { margin-left: -18px; margin-right: -18px; padding-left: 18px; padding-right: 18px; }
  .detail dl { grid-template-columns: 1fr; }
  .inline2, .password-row, .password-reveal { display: block; }
  .inline2 input { max-width: none; margin-bottom: 10px; }
  .password-row button, .password-reveal button { width: 100%; margin-top: 8px; }
  .top { align-items: flex-start; flex-direction: column; }
  .search { flex-direction: column; }
}
