:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --surface: #ffffff;
  --ink: #17211f;
  --muted: #60706b;
  --line: #d9e2df;
  --primary: #1f8f75;
  --primary-dark: #126854;
  --accent: #f2a541;
  --danger: #c94c4c;
  --ok: #2e8f58;
  --shadow: 0 14px 35px rgba(23, 33, 31, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(31, 143, 117, 0.1), rgba(244, 247, 246, 0) 280px),
    var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.shell {
  width: min(100%, 780px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 14px 96px;
}

.lock-view {
  display: grid;
  align-content: center;
  min-height: 100vh;
  padding-bottom: 80px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 28px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 22px;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 20px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(23, 33, 31, 0.06);
}

.lock-panel,
.backup-panel,
.danger-panel {
  padding: 16px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field textarea,
.search-field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fbfdfc;
  outline: none;
}

.field textarea {
  resize: vertical;
  line-height: 1.45;
}

.field input:focus,
.field textarea:focus,
.search-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 143, 117, 0.15);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.file-button,
.compact-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.primary-button {
  width: 100%;
  color: #fff;
  background: var(--primary);
}

.primary-button:active {
  background: var(--primary-dark);
}

.secondary-button,
.file-button {
  color: #0f5445;
  background: #dcf4ee;
}

.ghost-button,
.compact-action {
  color: var(--ink);
  background: #eef3f1;
}

.danger-button {
  color: #fff;
  background: var(--danger);
}

.hint {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.error-text {
  min-height: 20px;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.warning {
  margin-top: 16px;
  border: 1px solid rgba(201, 76, 76, 0.3);
  border-radius: 8px;
  padding: 12px;
  background: #fff0ef;
  color: #903030;
  font-weight: 700;
}

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

.app-header h1 {
  margin-bottom: 0;
  font-size: 24px;
}

.app-header .ghost-button {
  flex: 0 0 auto;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.stat {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}

.stat strong {
  display: block;
  font-size: 24px;
  line-height: 1.1;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.tabs,
.filters,
.button-row,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 0 -14px 14px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(217, 226, 223, 0.8);
  background: rgba(244, 247, 246, 0.92);
  backdrop-filter: blur(12px);
}

.tab,
.filter {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--muted);
  background: #e7eeeb;
  font-weight: 800;
}

.tab.is-active,
.filter.is-active {
  color: #fff;
  background: var(--primary);
}

.toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.search-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.account-list {
  display: grid;
  gap: 10px;
}

.account-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(23, 33, 31, 0.06);
}

.card-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.card-title {
  min-width: 0;
}

.card-title h3 {
  overflow-wrap: anywhere;
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.25;
}

.login-text,
.meta-text {
  overflow-wrap: anywhere;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  min-height: 30px;
  border-radius: 8px;
  padding: 4px 9px;
  background: #edf6f1;
  color: var(--ok);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.badge.soon {
  background: #fff5df;
  color: #94600f;
}

.badge.expired {
  background: #ffeceb;
  color: #a33434;
}

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

.meta-pill {
  border-radius: 8px;
  padding: 8px 10px;
  background: #f3f6f5;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.card-actions {
  align-items: center;
}

.compact-action {
  min-height: 38px;
  padding: 0 11px;
  font-size: 13px;
}

.compact-action.danger {
  color: #9a3030;
  background: #ffe9e8;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}

.empty-state strong {
  color: var(--ink);
}

.form-stack {
  display: grid;
  gap: 12px;
}

.form-stack .panel {
  padding: 14px;
}

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

.grid-two .field {
  min-width: 0;
}

.sticky-actions {
  position: sticky;
  bottom: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.sticky-actions .primary-button {
  width: auto;
}

.backup-panel,
.danger-panel {
  margin-bottom: 12px;
}

.file-button {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 30;
  width: min(calc(100% - 28px), 460px);
  transform: translateX(-50%);
  border-radius: 8px;
  padding: 12px 14px;
  color: #fff;
  background: rgba(23, 33, 31, 0.94);
  box-shadow: var(--shadow);
  text-align: center;
  font-weight: 800;
}

[hidden] {
  display: none !important;
}

@media (min-width: 680px) {
  .shell {
    padding-top: 34px;
  }

  h1 {
    font-size: 36px;
  }

  .lock-panel {
    max-width: 420px;
  }

  .toolbar {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .account-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
