:root {
  color: #1f2a25;
  background: #f5f3ee;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --ink: #1f2a25;
  --muted: #68726d;
  --paper: #fffdfa;
  --line: #dedbd3;
  --green: #176b50;
  --green-dark: #0d4d39;
  --green-soft: #e3f1eb;
  --amber: #a45d0b;
  --amber-soft: #fff0d8;
  --red: #a63d33;
  --red-soft: #fbe9e6;
  --shadow: 0 18px 50px rgba(36, 47, 41, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 90% 0%, rgba(23, 107, 80, 0.08), transparent 28rem),
    #f5f3ee;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

.shell { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px max(24px, calc((100vw - 1180px) / 2));
  background: rgba(245, 243, 238, 0.88);
  border-bottom: 1px solid rgba(31, 42, 37, 0.08);
  backdrop-filter: blur(16px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: white;
  background: var(--green);
  border-radius: 12px;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.brand-name { font-size: 15px; font-weight: 760; letter-spacing: -0.01em; }
.brand-subtitle { margin-top: 2px; color: var(--muted); font-size: 12px; }

.main {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 54px 0 80px;
}

.hero-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
h1 { margin: 0; font-size: clamp(32px, 5vw, 54px); letter-spacing: -0.055em; line-height: 0.98; }
.lede { max-width: 560px; margin: 14px 0 0; color: var(--muted); font-size: 16px; line-height: 1.6; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 720;
  box-shadow: 0 1px 2px rgba(31, 42, 37, 0.04);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}
.button:hover { border-color: #aaa99f; transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button.primary { color: white; background: var(--green); border-color: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.danger { color: var(--red); }
.button.danger:hover { background: var(--red-soft); border-color: #e3b4ad; }
.button.ghost { background: transparent; box-shadow: none; }
.button.small { min-height: 34px; padding: 0 11px; border-radius: 10px; font-size: 13px; }
.button.icon { width: 38px; padding: 0; }
.button[disabled] { cursor: not-allowed; opacity: 0.5; transform: none; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 36px 0 24px;
}
.stat { padding: 18px 20px; background: rgba(255, 253, 250, 0.65); border: 1px solid var(--line); border-radius: 16px; }
.stat-value { font-size: 26px; font-weight: 780; letter-spacing: -0.04em; }
.stat-label { margin-top: 5px; color: var(--muted); font-size: 13px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 18px; }
.search-wrap { position: relative; width: min(360px, 100%); }
.search-wrap span { position: absolute; left: 14px; top: 50%; color: var(--muted); transform: translateY(-50%); }
.search { width: 100%; height: 44px; padding: 0 14px 0 39px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; outline: none; }
.search:focus, input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 107, 80, 0.1); }
.sort-note { color: var(--muted); font-size: 13px; }

.entry-list { display: grid; gap: 12px; }
.entry-card {
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 30px rgba(36, 47, 41, 0.035);
}
.entry-card.deleting { border-color: #e6c088; }
.entry-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; padding: 22px 22px 18px; }
.entry-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.entry-title { margin: 0; overflow-wrap: anywhere; font-size: 19px; letter-spacing: -0.025em; }
.chip { display: inline-flex; align-items: center; min-height: 25px; padding: 0 9px; border-radius: 999px; color: var(--muted); background: #efeee9; font-size: 11px; font-weight: 760; letter-spacing: 0.02em; }
.chip.green { color: var(--green-dark); background: var(--green-soft); }
.chip.amber { color: #7a4305; background: var(--amber-soft); }
.entry-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 9px; color: var(--muted); font-size: 12px; }
.pin-button.active { color: var(--green); background: var(--green-soft); border-color: #b8d9ca; }

.deletion-strip { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 22px; color: #70420e; background: var(--amber-soft); border-top: 1px solid #f1d19f; border-bottom: 1px solid #f1d19f; font-size: 13px; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 780; }

.entry-body { display: grid; grid-template-columns: 1.2fr 1fr; border-top: 1px solid var(--line); }
.credentials { display: grid; grid-template-columns: 1fr 1.35fr; gap: 18px; padding: 20px 22px; border-right: 1px solid var(--line); }
.field-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 780; letter-spacing: 0.08em; text-transform: uppercase; }
.field-value { min-height: 22px; overflow-wrap: anywhere; font-size: 14px; font-weight: 650; }
.secret-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.secret-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notes { padding: 20px 22px; }
.notes textarea { width: 100%; min-height: 76px; padding: 11px 12px; resize: vertical; color: var(--ink); background: #faf9f5; border: 1px solid var(--line); border-radius: 10px; outline: none; line-height: 1.45; }
.notes-footer { display: flex; align-items: center; justify-content: flex-end; margin-top: 8px; }
.entry-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 13px 22px; background: #faf9f5; border-top: 1px solid var(--line); }

.empty { padding: 64px 24px; text-align: center; background: var(--paper); border: 1px dashed #c7c5bc; border-radius: 18px; }
.empty-mark { display: grid; width: 48px; height: 48px; margin: 0 auto 15px; place-items: center; color: var(--green); background: var(--green-soft); border-radius: 15px; font-size: 24px; }
.empty h2 { margin: 0; font-size: 19px; }
.empty p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

dialog { width: min(500px, calc(100% - 32px)); padding: 0; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(22, 30, 26, 0.42); backdrop-filter: blur(3px); }
.dialog-inner { padding: 26px; }
.dialog-inner h2 { margin: 0; font-size: 23px; letter-spacing: -0.035em; }
.dialog-inner > p { margin: 9px 0 22px; color: var(--muted); line-height: 1.5; }
.form-field { display: block; margin-top: 18px; }
.form-field:first-of-type { margin-top: 0; }
.form-field input, .form-field textarea { width: 100%; margin-top: 8px; padding: 12px 13px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 11px; outline: none; }
.form-field input { height: 46px; }
.form-field small { display: block; margin-top: 7px; color: var(--muted); line-height: 1.4; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; }
.link-result { padding: 14px; background: var(--green-soft); border: 1px solid #bad9cc; border-radius: 12px; }
.link-box { display: flex; gap: 8px; margin-top: 8px; }
.link-box input { min-width: 0; flex: 1; height: 42px; padding: 0 11px; background: white; border: 1px solid #bad9cc; border-radius: 9px; }

.public-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(280px, 0.8fr) minmax(440px, 1.2fr); }
.public-aside { display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: clamp(32px, 6vw, 72px); color: white; background: var(--green-dark); }
.public-aside .brand-subtitle { color: rgba(255, 255, 255, 0.62); }
.public-aside .brand-mark { color: var(--green-dark); background: #c9e8da; }
.public-aside .eyebrow { color: #a9d8c5; }
.aside-copy { max-width: 500px; }
.aside-copy h1 { font-size: clamp(42px, 6vw, 72px); }
.aside-copy p { margin: 22px 0 0; color: rgba(255, 255, 255, 0.7); font-size: 16px; line-height: 1.7; }
.aside-foot { color: rgba(255, 255, 255, 0.5); font-size: 12px; }
.public-main { display: grid; align-items: center; min-height: 100vh; padding: clamp(28px, 7vw, 90px); }
.public-card { width: min(540px, 100%); margin: 0 auto; }
.step { margin-bottom: 12px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.public-card h2 { margin: 0; font-size: clamp(30px, 4vw, 44px); letter-spacing: -0.045em; }
.public-card .intro { margin: 13px 0 30px; color: var(--muted); line-height: 1.6; }
.public-card form .button { width: 100%; margin-top: 24px; }
.customer-label { display: inline-flex; margin-bottom: 22px; padding: 7px 11px; color: var(--green-dark); background: var(--green-soft); border-radius: 8px; font-size: 13px; font-weight: 750; }
.privacy-note { display: flex; gap: 10px; margin-top: 18px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.public-divider { height: 1px; margin: 34px 0 22px; background: var(--line); }
.text-button { padding: 0; color: var(--muted); background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; }
.danger-panel { padding: 18px; color: #70420e; background: var(--amber-soft); border: 1px solid #efcc96; border-radius: 14px; }
.danger-panel h3 { margin: 0 0 7px; font-size: 16px; }
.danger-panel p { margin: 0; font-size: 13px; line-height: 1.5; }
.danger-panel .button { margin-top: 15px; width: auto; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 30; max-width: min(380px, calc(100% - 44px)); padding: 12px 15px; color: white; background: #24322b; border-radius: 11px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: 160ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }
.loading { display: grid; min-height: 60vh; place-items: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid #d9d8d1; border-top-color: var(--green); border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
  .main { width: min(100% - 28px, 680px); padding-top: 34px; }
  .topbar { padding: 14px; }
  .hero-row { align-items: start; flex-direction: column; }
  .stats { grid-template-columns: 1fr; }
  .stat { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; }
  .stat-value { font-size: 21px; }
  .entry-head { gap: 12px; padding: 18px 16px 15px; }
  .entry-body { grid-template-columns: 1fr; }
  .credentials { border-right: 0; border-bottom: 1px solid var(--line); }
  .notes, .credentials { padding: 17px 16px; }
  .entry-actions { padding: 12px 16px; }
  .deletion-strip { align-items: start; flex-direction: column; padding: 11px 16px; }
  .public-shell { grid-template-columns: 1fr; }
  .public-aside { min-height: auto; padding: 28px 24px; }
  .aside-copy, .aside-foot { display: none; }
  .public-main { min-height: auto; padding: 48px 24px 70px; }
}

@media (max-width: 520px) {
  .brand-subtitle, .sort-note { display: none; }
  .credentials { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search-wrap { width: 100%; }
  .entry-actions .button { flex: 1; }
}
