:root {
  --paper: #f2eee5;
  --paper-deep: #e8e1d4;
  --ink: #1c2925;
  --muted: #73766f;
  --line: rgba(28, 41, 37, .13);
  --green: #1f4d3e;
  --orange: #c7683d;
  --white: #fffdf8;
  --shadow: 0 18px 50px rgba(39, 45, 40, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); font-family: "Segoe UI", "Microsoft YaHei", sans-serif; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
.grain { position: fixed; inset: 0; pointer-events: none; z-index: 20; opacity: .18; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E"); }
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,253,248,.82); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.login-brand { margin: 0 0 50px; }
.login-card h1 { font-size: 42px; }
.login-copy { margin: 10px 0 28px; color: var(--muted); font-size: 13px; }
.login-card form { display: grid; gap: 16px; }
.login-button { margin-top: 5px; width: 100%; }
.form-error { min-height: 18px; margin: 0; color: #a34132; font-size: 12px; }
.security-line { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 10px; }
.security-line span { color: #58a16c; font-size: 8px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(230px, 18vw) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 34px 22px 24px; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: rgba(242,238,229,.87); backdrop-filter: blur(12px); z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 42px; }
.brand-mark { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #f9f1df; font: 600 21px "STSong", "SimSun", serif; }
.brand strong { display: block; font: 700 20px "STSong", "SimSun", serif; letter-spacing: .08em; }
.brand span { display: block; margin-top: 2px; font-size: 8px; letter-spacing: .22em; color: var(--muted); }
.nav-list { display: flex; flex-direction: column; gap: 5px; }
.nav-item { width: 100%; border: 0; background: transparent; padding: 11px 12px; border-radius: 10px; display: grid; grid-template-columns: 25px 1fr auto; text-align: left; cursor: pointer; color: #646a65; transition: .18s ease; }
.nav-item:hover { background: rgba(255,255,255,.55); color: var(--ink); }
.nav-item.active { background: var(--green); color: #fff; box-shadow: 0 7px 18px rgba(31,77,62,.18); }
.nav-item b { font-size: 11px; font-weight: 500; min-width: 22px; text-align: center; padding: 2px 5px; border-radius: 9px; background: rgba(28,41,37,.08); }
.nav-item.active b { background: rgba(255,255,255,.16); }
.vault-nav { margin-top: 5px; border: 1px solid rgba(199,104,61,.18); }
.nav-icon { font-size: 16px; }
.nav-label { margin: 25px 12px 8px; font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: #999a93; }
.sidebar-footer { margin-top: auto; display: grid; gap: 3px; }
.privacy-note { display: flex; gap: 9px; padding: 13px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; }
.privacy-note > span { color: #58a16c; font-size: 9px; margin-top: 4px; }
.privacy-note strong, .privacy-note small { display: block; }
.privacy-note strong { font-size: 11px; }
.privacy-note small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.text-button { border: 0; background: none; text-align: left; padding: 8px 13px; color: var(--muted); font-size: 12px; cursor: pointer; }
.text-button:hover { color: var(--orange); }
.logout-button { margin-top: 6px; color: #9d4a38; }
.main { min-width: 0; }
.topbar { height: 86px; padding: 0 clamp(24px, 3vw, 52px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.search-wrap { width: min(480px, 50vw); display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 10px 2px; }
.search-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-wrap input::placeholder { color: #a09f97; }
kbd { border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; color: #999a93; font-size: 10px; }
.primary-button, .secondary-button, .ghost-button, .danger-button { border: 0; border-radius: 9px; padding: 12px 18px; cursor: pointer; font-weight: 600; transition: .18s ease; }
.primary-button { background: var(--orange); color: #fff; box-shadow: 0 7px 18px rgba(199,104,61,.2); }
.primary-button:hover { transform: translateY(-1px); background: #b85c34; }
.secondary-button { background: var(--green); color: white; }
.ghost-button { background: transparent; border: 1px solid var(--line); }
.danger-button { color: #a34132; background: #f5e7e1; }
.content { width: 100%; padding: 42px clamp(24px, 3vw, 52px) 64px; margin: 0; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 26px; }
.eyebrow { margin: 0 0 10px; color: var(--orange); font-size: 9px; font-weight: 600; letter-spacing: .22em; }
h1, h2 { font-family: "STSong", "SimSun", serif; }
h1 { margin: 0; font-size: clamp(34px, 4vw, 54px); font-weight: 600; letter-spacing: -.04em; }
.page-heading > div > p:last-child { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.view-actions { display: flex; gap: 7px; }
.icon-button, .menu-button, .close-button, .favorite-button { border: 0; background: transparent; cursor: pointer; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); }
.icon-button.active { background: var(--ink); color: white; }
.menu-button { display: none; font-size: 20px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { position: relative; overflow: hidden; min-height: 88px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,253,248,.52); }
.stat::after { content: ""; position: absolute; width: 70px; height: 70px; border: 1px solid var(--line); border-radius: 50%; right: -20px; bottom: -30px; }
.stat strong { display: block; font: 600 29px "STSong", "SimSun", serif; }
.stat span { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.active-filter { margin-bottom: 18px; color: var(--muted); font-size: 12px; }
.account-table-wrap { min-height: 52vh; max-height: calc(100vh - 310px); overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--white); box-shadow: 0 10px 35px rgba(39,45,40,.07); }
.account-table { width: 100%; min-width: 1260px; border-collapse: collapse; table-layout: fixed; }
.account-table th { position: sticky; top: 0; z-index: 2; height: 48px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #e6e0d4; color: #555d58; text-align: left; font-size: 11px; letter-spacing: .05em; }
.account-table td { height: 68px; padding: 12px 16px; border-bottom: 1px solid var(--line); border-right: 1px solid rgba(28,41,37,.06); vertical-align: middle; font-size: 12px; }
.account-table tr:last-child td { border-bottom: 0; }
.account-table tbody tr:hover { background: #faf7f0; }
.account-table th:nth-child(1) { width: 190px; }
.account-table th:nth-child(2) { width: 180px; }
.account-table th:nth-child(3) { width: 190px; }
.account-table th:nth-child(4) { width: 200px; }
.account-table th:nth-child(5) { width: 250px; }
.account-table th:nth-child(6) { width: 150px; }
.account-table th:nth-child(7) { width: 100px; }
.account-table th:nth-child(8) { width: 180px; }
.name-cell { display: flex; align-items: center; gap: 8px; }
.name-cell strong, .name-cell small { display: block; }
.name-cell strong { max-width: 135px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.name-cell small { margin-top: 3px; color: var(--orange); font-size: 9px; }
.cell-value, .masked-password { display: inline-block; max-width: 125px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.cell-action { border: 0; background: none; color: var(--orange); font-size: 9px; cursor: pointer; }
.table-link { display: block; overflow: hidden; color: var(--green); text-overflow: ellipsis; white-space: nowrap; }
.note-cell { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.table-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.table-tags span { padding: 3px 5px; border-radius: 5px; background: #eee9df; color: var(--muted); font-size: 8px; }
.date-cell { color: var(--muted); white-space: nowrap; }
.row-actions { display: flex; gap: 6px; }
.row-actions button { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: transparent; color: var(--muted); font-size: 9px; cursor: pointer; }
.row-actions button:hover { border-color: var(--orange); color: var(--orange); }
.row-actions button:disabled { opacity: .35; cursor: default; }
.info-card { min-height: 245px; padding: 23px; border-radius: 15px; background: var(--white); border: 1px solid rgba(28,41,37,.08); box-shadow: 0 3px 0 rgba(28,41,37,.025); display: flex; flex-direction: column; cursor: pointer; transition: .22s ease; animation: rise .35s both; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: rgba(31,77,62,.2); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.category-pill { padding: 5px 9px; border-radius: 20px; color: var(--green); background: #e6eee8; font-size: 9px; font-weight: 600; letter-spacing: .08em; }
.vault-pill { color: #8b482e; background: #f5e6de; }
.favorite-button { font-size: 20px; color: #a7a79f; }
.favorite-button.on { color: var(--orange); }
.info-card h3 { margin: 23px 0 9px; font: 600 20px "STSong", "SimSun", serif; }
.card-summary { margin: 0; min-height: 40px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.sensitive-preview { filter: blur(5px); user-select: none; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: auto 0 17px; padding-top: 22px; }
.tag { color: #858780; font-size: 9px; }
.tag::before { content: "#"; color: var(--orange); }
.card-footer { display: flex; justify-content: space-between; padding-top: 13px; border-top: 1px solid var(--line); color: #9a9b94; font-size: 9px; }
.password-card { border-color: rgba(199,104,61,.16); }
.credential-preview { display: grid; gap: 10px; margin: 17px 0; }
.credential-preview > div { display: grid; grid-template-columns: 46px 1fr; align-items: center; padding: 9px 11px; border-radius: 8px; background: #f7f3eb; }
.credential-preview span { color: var(--muted); font-size: 9px; }
.credential-preview strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.masked-password { letter-spacing: .15em; }
.password-card-actions { display: flex; gap: 7px; margin: auto 0 16px; flex-wrap: wrap; }
.password-card-actions button { border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; background: transparent; color: var(--muted); font-size: 9px; cursor: pointer; }
.password-card-actions button:hover { border-color: var(--orange); color: var(--orange); }
.empty-state { text-align: center; padding: 80px 20px; }
.empty-icon { font-size: 42px; color: var(--orange); }
.empty-state h2 { margin-bottom: 7px; }
.empty-state p { color: var(--muted); margin-bottom: 24px; }
dialog { width: min(650px, calc(100vw - 30px)); border: 0; border-radius: 18px; padding: 0; color: var(--ink); background: var(--white); box-shadow: 0 30px 100px rgba(15,28,24,.3); }
dialog::backdrop { background: rgba(20,31,27,.55); backdrop-filter: blur(4px); }
#itemForm { padding: 30px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 25px; }
.dialog-head h2 { margin: 0; font-size: 27px; }
.close-button { font-size: 28px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 7px; color: var(--muted); font-size: 11px; }
.field.full, .check-field.full { grid-column: 1 / -1; }
.credential-fields.full { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 17px; border: 1px solid rgba(199,104,61,.18); border-radius: 12px; background: #f9f4ec; }
.credential-fields[hidden] { display: none; }
.password-input-wrap { display: grid; grid-template-columns: 1fr auto; }
.password-input-wrap input { border-radius: 9px 0 0 9px; }
.inline-button { border: 1px solid var(--line); border-left: 0; border-radius: 0 9px 9px 0; padding: 0 12px; background: #eee9df; cursor: pointer; color: var(--muted); font-size: 10px; }
.password-tools { display: flex; align-items: center; gap: 12px; }
.password-tools span { color: var(--muted); font-size: 10px; }
.compact-button { padding: 8px 11px; font-size: 10px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: #faf8f2; padding: 12px; outline: none; color: var(--ink); resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,77,62,.08); }
.check-field { display: flex; align-items: center; gap: 9px; font-size: 11px; color: var(--muted); }
.dialog-actions { display: flex; align-items: center; gap: 10px; margin-top: 27px; }
.dialog-actions span { flex: 1; }
.toast { position: fixed; right: 25px; bottom: 25px; z-index: 30; padding: 12px 17px; border-radius: 9px; background: var(--ink); color: white; font-size: 12px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); width: 270px; transition: .25s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: block; }
  .topbar { height: 76px; padding: 0 20px; gap: 12px; }
  .search-wrap { flex: 1; width: auto; }
  kbd, .topbar .primary-button span { display: none; }
  .topbar .primary-button { padding: 10px 13px; white-space: nowrap; }
  .content { padding: 42px 20px 60px; }
  .stats { grid-template-columns: 1fr; }
  .stat { min-height: auto; }
}
@media (min-width: 1600px) {
  .app-shell { grid-template-columns: 280px minmax(0, 1fr); }
  .content { padding-left: 58px; padding-right: 58px; }
  .account-table { min-width: 1380px; }
  .account-table-wrap { max-height: calc(100vh - 290px); }
}
@media (max-width: 560px) {
  .login-card { padding: 30px 24px; }
  .page-heading { align-items: flex-start; }
  .view-actions { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full, .check-field.full { grid-column: auto; }
  .credential-fields.full { grid-column: auto; grid-template-columns: 1fr; }
  #itemForm { padding: 23px; }
}
