:root {
  --bg: #f4efe7;
  --bg-soft: #fbf7f1;
  --card: #ffffff;
  --text: #1d1915;
  --muted: #73685d;
  --border: #e3d8ca;
  --accent: #9a7434;
  --accent-dark: #654612;
  --accent-soft: #f2e7d3;
  --danger: #9d2b2b;
  --danger-dark: #7b1f1f;
  --shadow: 0 18px 50px rgba(33, 25, 15, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(154, 116, 52, 0.14), transparent 34rem),
    linear-gradient(180deg, #fbf8f3 0%, var(--bg) 42%, #efe7dc 100%);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.42) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.35) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.35;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: rgba(21, 18, 15, 0.96);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand {
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 30px 18px 64px;
  position: relative;
}

.card, .note-card, .hero-card, .stat-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(227, 216, 202, 0.92);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.card, .note-card { padding: 22px; }

.hero-card {
  padding: 28px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(248,241,230,0.96));
}

.hero-card h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
}

.narrow {
  max-width: 440px;
  margin: 60px auto;
}

.grid.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.create-card {
  position: sticky;
  top: 84px;
}

.content-area {
  min-width: 0;
}

h1, h2 {
  margin-top: 0;
  line-height: 1.2;
}

h1 { font-size: 1.45rem; }
h2 { font-size: 1.08rem; }

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-dark);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h1 { margin-bottom: 0; }

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stack.compact { margin-top: 18px; }

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-weight: 700;
}

input, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 13px;
  font: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, textarea:focus {
  border-color: rgba(154, 116, 52, 0.7);
  box-shadow: 0 0 0 4px rgba(154, 116, 52, 0.14);
}

textarea { resize: vertical; }

button, .secondary-button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(101, 70, 18, 0.14);
}

button:hover, .secondary-button:hover {
  background: var(--accent-dark);
  text-decoration: none;
}

.link-button {
  background: transparent;
  color: #fff;
  padding: 0;
  box-shadow: none;
}

.danger { background: var(--danger); }
.danger:hover { background: var(--danger-dark); }
.small { padding: 7px 12px; font-size: 0.84rem; }
.tiny { padding: 4px 9px; font-size: 0.78rem; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0;
  padding: 6px;
  background: rgba(255,255,255,0.64);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: fit-content;
  box-shadow: 0 10px 30px rgba(33,25,15,0.05);
}

.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 800;
}

.tab:hover { text-decoration: none; color: var(--accent-dark); }
.tab.active { background: #17130f; color: #fff; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

.stat-card {
  padding: 18px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.55rem;
}

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

.note-card {
  display: flex;
  flex-direction: column;
  min-height: 190px;
}

.note-card p:last-of-type { flex: 1; }

.note-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-dark);
  white-space: nowrap;
}

.muted { color: var(--muted); }
.small-text { font-size: 0.9rem; }

.notice {
  border: 1px solid #d5c294;
  background: #fff8e5;
  color: #4d3b13;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 18px;
}

.search-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-row input { flex: 1; }
.toolbar-card { margin-bottom: 18px; }
.files-panel-card { margin-bottom: 0; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  background: #fff;
}

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

tr:last-child td { border-bottom: 0; }
th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.row-actions, .card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.file-list {
  padding-left: 20px;
}

.file-list li {
  margin: 8px 0;
}

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

section { margin-bottom: 24px; }

.live-status {
  display: inline-flex;
  align-items: center;
  border: 1px solid #c8dec6;
  background: #f1fbef;
  color: #315a2c;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.live-status.offline {
  border-color: #e1c1c1;
  background: #fff2f2;
  color: #743333;
}

.upload-progress {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: #fbf8f3;
}

.upload-bar {
  width: 100%;
  height: 12px;
  background: #e8dfd4;
  border-radius: 999px;
  overflow: hidden;
}

.upload-bar span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.15s ease;
}

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

@media (max-width: 980px) {
  .panel-layout { grid-template-columns: 1fr; }
  .create-card { position: static; }
  .notes-list { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .grid.two, .stats-grid { grid-template-columns: 1fr; }
  .search-row { flex-direction: column; align-items: stretch; }
  .hero-card { flex-direction: column; align-items: flex-start; padding: 22px; }
  .tabs { width: 100%; }
  .tab { flex: 1; }
  .topbar { padding: 14px 16px; }
  .container { padding: 20px 12px 50px; }
  .card, .note-card { padding: 18px; border-radius: 16px; }
  .section-heading { flex-direction: column; }
}

.info-box {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: #fbf8f3;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}

code {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px 6px;
  color: var(--accent-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

select {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

.buttonlike {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(101, 70, 18, 0.14);
}

.buttonlike:hover {
  background: var(--accent-dark);
  color: #fff;
  text-decoration: none;
}

.share-create-form {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.share-create-form label {
  min-width: 150px;
}

.share-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.share-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: #fbf8f3;
}

.share-item.inactive {
  opacity: 0.65;
}

.share-url {
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
}

.file-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.shared-card {
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}

.shared-note-body {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: #fbf8f3;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 820px) {
  .share-item { grid-template-columns: 1fr; }
  .share-create-form { align-items: stretch; }
  .share-create-form label, .share-create-form button, .share-create-form select { width: 100%; }
}

/* User-friendly interface update */
body {
  background:
    radial-gradient(circle at 10% 0%, rgba(154, 116, 52, 0.12), transparent 36rem),
    radial-gradient(circle at 90% 8%, rgba(65, 50, 34, 0.07), transparent 32rem),
    linear-gradient(180deg, #fbf8f3 0%, #f4efe7 48%, #eee4d8 100%);
}

.topbar {
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand:hover { text-decoration: none; }

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #d1b06c, #8a6425);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.brand strong {
  display: block;
  line-height: 1.1;
}

.brand small {
  display: block;
  color: rgba(255,255,255,0.62);
  font-size: 0.76rem;
  font-weight: 600;
  margin-top: 2px;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.user-pill {
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.84rem;
  color: rgba(255,255,255,0.84);
}

.login-shell {
  min-height: calc(100vh - 160px);
  display: grid;
  place-items: center;
}

.login-card {
  margin: 30px auto;
  max-width: 480px;
}

.login-card h1 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.wide-button { width: 100%; }

.app-hero {
  align-items: stretch;
  overflow: hidden;
}

.app-hero > div:first-child {
  max-width: 760px;
}

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

.light-button {
  background: #fff;
  color: var(--accent-dark);
  border: 1px solid var(--border);
  box-shadow: none;
}

.light-button:hover {
  color: #fff;
}

.hero-side {
  min-width: 250px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.68);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.hero-side p { margin: 0; }

.stat-link {
  color: var(--text);
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.stat-link:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: rgba(154,116,52,0.45);
}

.stat-card small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
  font-size: 0.78rem;
}

.tabs {
  position: sticky;
  top: 76px;
  z-index: 8;
  width: 100%;
  border-radius: 20px;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(16px);
  justify-content: space-between;
}

.tab {
  flex: 1;
  gap: 10px;
  min-height: 46px;
}

.tab em {
  min-width: 26px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.06);
  color: inherit;
  font-style: normal;
  font-size: 0.78rem;
  padding: 0 8px;
}

.tab.active em {
  background: rgba(255,255,255,0.18);
}

.create-card {
  border-top: 4px solid rgba(154,116,52,0.7);
}

.create-card h1,
.files-panel-card h1,
.section-heading h1 {
  font-size: 1.35rem;
}

.note-card {
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.note-card:hover {
  transform: translateY(-2px);
  border-color: rgba(154,116,52,0.38);
  box-shadow: 0 22px 55px rgba(33, 25, 15, 0.11);
}

.note-card h2 {
  margin-bottom: 4px;
}

.note-preview {
  color: #332b24;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-actions {
  margin-top: 14px;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.file-drop {
  border: 1.5px dashed #cbb99e;
  border-radius: 18px;
  padding: 16px;
  background: #fffaf3;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.file-drop input[type="file"] {
  margin-top: 4px;
  border: 0;
  padding: 0;
  background: transparent;
}

.file-drop-text {
  display: block;
  margin-top: 8px;
  border-radius: 12px;
  background: rgba(154,116,52,0.09);
  color: var(--accent-dark);
  padding: 9px 11px;
  font-weight: 700;
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.file-drop.dragging,
.file-drop.has-file {
  border-color: var(--accent);
  background: #fff6e8;
  box-shadow: 0 0 0 4px rgba(154, 116, 52, 0.10);
}

.file-name-cell {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 260px;
}

.file-icon,
.empty-icon {
  flex: none;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 900;
  border: 1px solid var(--border);
}

.empty-state {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border: 1px dashed #cbb99e;
  border-radius: 18px;
  background: #fffaf3;
}

.empty-state p {
  margin: 4px 0 0;
}

.table-wrap {
  background: #fff;
}

tbody tr:hover td {
  background: #fffaf3;
}

.copy-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
}

.copy-field input {
  min-width: 0;
}

.table-share-url {
  width: 280px;
}

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

.help-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: #fbf8f3;
}

.help-card strong,
.help-card span {
  display: block;
}

.help-card span {
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.9rem;
}

.command-box {
  align-items: flex-start;
}

.command-box code {
  width: 100%;
  overflow-x: auto;
  display: block;
  padding: 10px;
}

.shared-card h1,
.card[data-note-id] h1 {
  font-size: clamp(1.45rem, 3vw, 2.1rem);
}

.card[data-note-id] textarea {
  min-height: 360px;
}

@media (max-width: 980px) {
  .tabs {
    position: static;
  }
  .hero-side {
    min-width: 0;
  }
  .help-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .brand small,
  .user-pill { display: none; }
  .topbar-actions { gap: 10px; }
  .quick-actions,
  .row-actions,
  .card-actions,
  .copy-field { align-items: stretch; }
  .quick-actions > *,
  .row-actions > *,
  .row-actions form,
  .row-actions button,
  .row-actions a,
  .card-actions a,
  .copy-field button { width: 100%; }
  .copy-field { flex-direction: column; min-width: 0; }
  .table-share-url { width: 100%; }
  .tabs { border-radius: 18px; }
  .tab { flex-basis: calc(50% - 6px); }
  .tab span { font-size: 0.86rem; }
  .file-name-cell { min-width: 220px; }
}

@media (max-width: 520px) {
  .tab { flex-basis: 100%; justify-content: space-between; }
  .hero-card h1 { font-size: 1.55rem; }
  .stats-grid { gap: 10px; }
}

.password-form .secret-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.password-form .secret-input-row input {
  min-width: 0;
}

.secret-mask,
.secret-text {
  display: inline-block;
  max-width: 260px;
  overflow-wrap: anywhere;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px 8px;
}

.password-detail-card {
  margin-bottom: 18px;
}

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

.credential-box {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: var(--bg-soft);
  min-width: 0;
}

.credential-box span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.secret-reveal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

@media (max-width: 980px) {
  .credential-grid {
    grid-template-columns: 1fr;
  }
}

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

.password-list-secret {
  align-items: flex-start;
  gap: 8px;
}

.secret-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.copy-button.copied {
  border-color: rgba(22, 163, 74, 0.35);
  background: rgba(22, 163, 74, 0.08);
}

.manual-copy-sheet {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1000;
}

.manual-copy-sheet.active {
  display: flex;
}

.manual-copy-card {
  width: min(620px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.manual-copy-card textarea {
  width: 100%;
  min-height: 120px;
  margin-top: 12px;
  font-size: 16px;
  resize: vertical;
}

.section-heading.compact {
  margin-bottom: 8px;
}

@media (max-width: 720px) {
  .section-actions {
    width: 100%;
    justify-content: stretch;
  }

  .section-actions .secondary-button,
  .secret-actions .secondary-button,
  .secret-actions .copy-button {
    width: auto;
    min-height: 38px;
  }

  .password-list-secret {
    min-width: 220px;
  }

  .manual-copy-sheet {
    padding: 10px;
  }
}

/* Vanara branding update */
.brand-logo {
  width: 144px;
  height: auto;
  max-height: 48px;
  display: block;
  background: #fff;
  border-radius: 12px;
  padding: 5px 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.20);
}

.brand-text {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.login-logo {
  width: 156px;
  height: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 10px;
  box-shadow: 0 14px 34px rgba(33, 25, 15, 0.08);
}

@media (max-width: 820px) {
  .brand-logo {
    width: 104px;
    max-height: 40px;
    padding: 4px 6px;
  }

  .brand-text small {
    display: none;
  }

  .login-brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .login-logo {
    width: 170px;
  }
}

/* Mobile usability upgrade */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

button,
.secondary-button,
.buttonlike,
.tab,
.copy-button,
input,
textarea,
select {
  -webkit-tap-highlight-color: rgba(154, 116, 52, 0.18);
}

input,
textarea,
select {
  font-size: 16px;
}

button,
.secondary-button,
.buttonlike {
  min-height: 44px;
}

@media (max-width: 760px) {
  body {
    background:
      radial-gradient(circle at 0% 0%, rgba(154, 116, 52, 0.10), transparent 22rem),
      linear-gradient(180deg, #fbf8f3 0%, #f3ece2 100%);
  }

  body::before {
    opacity: 0.18;
    background-size: 34px 34px;
  }

  .topbar {
    min-height: 58px;
    padding: 8px 10px;
    gap: 8px;
  }

  .brand {
    min-width: 0;
    gap: 8px;
  }

  .brand-logo {
    width: 82px;
    max-height: 34px;
    border-radius: 9px;
    padding: 3px 5px;
  }

  .brand-text strong {
    max-width: 116px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.88rem;
  }

  .brand-text small,
  .user-pill {
    display: none;
  }

  .topbar-actions {
    flex: none;
    gap: 6px;
  }

  .link-button {
    min-height: 40px;
    padding: 8px 11px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    color: #fff;
  }

  .container {
    width: 100%;
    padding: 14px 10px calc(112px + env(safe-area-inset-bottom));
  }

  .narrow {
    margin: 18px auto;
  }

  .login-shell {
    min-height: calc(100vh - 90px);
    place-items: start center;
  }

  .login-card {
    width: 100%;
    margin: 10px 0 0;
  }

  .login-card h1 {
    font-size: 1.42rem;
  }

  .login-logo {
    width: 142px;
  }

  .card,
  .note-card,
  .hero-card,
  .stat-card {
    border-radius: 18px;
  }

  .card,
  .note-card {
    padding: 15px;
  }

  .hero-card {
    display: block;
    padding: 16px;
    margin-bottom: 12px;
  }

  .hero-card h1 {
    font-size: 1.42rem;
  }

  .hero-card p {
    font-size: 0.94rem;
  }

  .hero-side {
    margin-top: 12px;
    padding: 12px;
  }

  .quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 14px;
  }

  .quick-actions > * {
    width: 100%;
    min-height: 46px;
    padding-left: 10px;
    padding-right: 10px;
  }

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

  .stat-card {
    padding: 13px;
  }

  .stat-card strong {
    font-size: 1.18rem;
  }

  .stat-card small {
    font-size: 0.72rem;
  }

  .tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    z-index: 60;
    margin: 0;
    width: 100%;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    box-shadow: 0 -14px 36px rgba(33,25,15,0.13);
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    flex-basis: auto;
    min-width: 104px;
    min-height: 58px;
    padding: 7px 11px;
    flex-direction: column;
    gap: 3px;
    scroll-snap-align: center;
  }

  .tab span {
    font-size: 0.75rem;
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tab em {
    min-width: 22px;
    height: 20px;
    font-size: 0.67rem;
  }

  .panel-layout {
    gap: 12px;
  }

  .create-card,
  .files-panel-card,
  .toolbar-card {
    margin-bottom: 12px;
  }

  .create-card h1,
  .files-panel-card h1,
  .section-heading h1 {
    font-size: 1.16rem;
  }

  .section-heading {
    gap: 8px;
    margin-bottom: 12px;
  }

  .section-actions {
    align-items: stretch;
  }

  .section-actions > * {
    width: 100%;
  }

  .stack {
    gap: 12px;
  }

  label {
    gap: 6px;
  }

  input,
  textarea,
  select {
    min-height: 46px;
    border-radius: 13px;
    padding: 12px;
  }

  textarea {
    min-height: 116px;
  }

  .search-row {
    gap: 8px;
  }

  .search-row button,
  .search-row .secondary-button {
    width: 100%;
  }

  .notes-list {
    gap: 12px;
  }

  .note-card {
    min-height: 0;
  }

  .note-header {
    gap: 8px;
  }

  .note-preview {
    -webkit-line-clamp: 4;
  }

  .card-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: stretch;
  }

  .card-actions .secondary-button {
    width: 100%;
  }

  .file-drop {
    padding: 14px;
    border-radius: 16px;
  }

  .file-drop input[type="file"] {
    width: 100%;
    font-size: 0.92rem;
  }

  .file-drop-text {
    font-size: 0.84rem;
    padding: 10px;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap th,
  .table-wrap td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .table-wrap table {
    background: transparent;
    min-width: 0;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tr {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 12px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.96);
    box-shadow: 0 12px 30px rgba(33,25,15,0.07);
  }

  .table-wrap tr:last-child {
    margin-bottom: 0;
  }

  .table-wrap td {
    border: 0;
    padding: 8px 0;
    display: grid;
    grid-template-columns: minmax(86px, 34%) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    overflow-wrap: anywhere;
  }

  .table-wrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.25;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding-top: 3px;
  }

  .table-wrap td[colspan] {
    display: block;
  }

  .table-wrap td[colspan]::before {
    content: none;
  }

  .table-wrap td[data-label="Actions"] {
    display: block;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
  }

  .table-wrap td[data-label="Actions"]::before {
    display: block;
    margin-bottom: 8px;
  }

  tbody tr:hover td {
    background: transparent;
  }

  .file-name-cell {
    min-width: 0;
    gap: 9px;
    align-items: flex-start;
  }

  .file-name-cell strong,
  .file-name-cell a,
  td a,
  td code {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .file-icon,
  .empty-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
  }

  .row-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: stretch;
  }

  .row-actions form,
  .row-actions button,
  .row-actions a,
  .row-actions .share-create-form,
  .row-actions .secondary-button {
    width: 100%;
  }

  .share-create-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0;
    align-items: stretch;
  }

  .share-create-form select,
  .share-create-form button {
    width: 100%;
  }

  .copy-field {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    min-width: 0;
    width: 100%;
  }

  .copy-field button,
  .copy-field input {
    width: 100%;
  }

  .table-share-url {
    width: 100%;
  }

  .password-form .secret-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .secret-reveal,
  .password-list-secret {
    width: 100%;
  }

  .secret-mask,
  .secret-text {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    -webkit-user-select: text;
    user-select: text;
  }

  .secret-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 8px;
    margin-top: 4px;
  }

  .secret-actions .copy-button,
  .secret-actions .secondary-button {
    width: 100%;
  }

  .credential-grid {
    gap: 10px;
  }

  .credential-box {
    padding: 13px;
  }

  .help-grid {
    gap: 10px;
  }

  .help-card {
    padding: 12px;
  }

  .empty-state {
    padding: 14px;
    border-radius: 16px;
  }

  .info-box {
    padding: 12px;
  }

  .command-box code {
    font-size: 0.82rem;
    white-space: pre-wrap;
  }

  .manual-copy-sheet {
    align-items: flex-end;
    padding: 8px;
  }

  .manual-copy-card {
    border-radius: 22px 22px 14px 14px;
    padding: 15px;
  }

  .manual-copy-card textarea {
    font-size: 16px;
    min-height: 150px;
  }

  .shared-card,
  .card[data-note-id] {
    width: 100%;
  }

  .card[data-note-id] textarea {
    min-height: 280px;
  }
}

@media (max-width: 420px) {
  .quick-actions,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .tab {
    min-width: 96px;
  }

  .table-wrap td {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .table-wrap td::before {
    padding-top: 0;
  }

  .secret-actions {
    grid-template-columns: 1fr;
  }

  .password-form .secret-input-row {
    grid-template-columns: 1fr;
  }
}
