:root {
  --bg: #f6f2e8;
  --paper: #fffdf8;
  --ink: #2f2b26;
  --muted: #7a7166;
  --line: #e4dacb;
  --yellow: #f8e18a;
  --mint: #cfeee3;
  --rose: #f7d7cd;
  --lavender: #e5ddff;
  --accent: #3d6ae6;
  --accent-strong: #2f59cb;
  --danger: #c13e34;
  --shadow-soft: 0 14px 34px rgba(82, 68, 42, 0.12);
  --shadow-card: 0 8px 22px rgba(72, 58, 38, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: 'Noto Sans KR', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 225, 145, 0.52) 0%, transparent 28%),
    radial-gradient(circle at 90% 10%, rgba(188, 221, 255, 0.44) 0%, transparent 24%),
    linear-gradient(160deg, #f7f3ea 0%, #f6f2e8 48%, #f2efe8 100%);
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(0, 0, 0, 0.04) 0.35px, transparent 0.35px);
  background-size: 3px 3px;
  opacity: 0.24;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1200px, calc(100% - 30px));
  margin: 16px auto 28px;
  display: grid;
  gap: 14px;
}

.card {
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(7px);
}

.appbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 16px;
  align-items: start;
}

.brand-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: 'Manrope', sans-serif;
  font-size: 11px;
  color: #9b8869;
}

h1 {
  margin: 4px 0 0;
  font-family: 'Manrope', sans-serif;
  font-size: 32px;
  line-height: 1.1;
}

.brand-sub {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.auth-area {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.login-panel {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.stay-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.subtle {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.user-box {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  min-width: 310px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.7);
}

.user-box img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
}

.user-name {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.user-email {
  margin: 1px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.text-btn {
  border: none;
  background: transparent;
  color: #325bbb;
  cursor: pointer;
  padding: 6px;
  font-size: 13px;
  font-weight: 700;
}

.workspace {
  display: grid;
  gap: 12px;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
}

.path-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.path-label {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #4c6172;
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-secondary {
  background: #ece6da;
  color: #51493d;
}

.board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  align-items: start;
}

.item-card {
  border: 1px solid #efe4d4;
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow-card);
  padding: 12px;
  display: grid;
  gap: 10px;
  min-height: 150px;
  animation: rise-in 220ms ease both;
}

.item-card.folder {
  background: linear-gradient(160deg, #fff8d9 0%, #fff2bf 100%);
}

.item-card.secure {
  background: linear-gradient(170deg, #ffffff 0%, #fff9ef 100%);
}

.item-card.encoded {
  background: linear-gradient(170deg, #f3fbff 0%, #edf7ff 100%);
}

.item-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
}

.item-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 700;
  word-break: break-word;
}

.badge {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  white-space: nowrap;
}

.badge.secure {
  background: #fce9dc;
  color: #985f41;
}

.badge.encoded {
  background: #e3edff;
  color: #4a67a8;
}

.item-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.item-preview {
  margin: 0;
  font-size: 13px;
  color: #5a5147;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  min-height: 3.6em;
}

.item-actions {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.small-btn {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.78);
  color: #4f5c67;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.small-btn.danger {
  color: var(--danger);
}

.empty-card {
  grid-column: 1 / -1;
  border: 1px dashed #d8cdbb;
  border-radius: 16px;
  padding: 20px;
  background: rgba(255, 254, 250, 0.74);
}

.empty-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  border-radius: 10px;
  background: #2f2a24;
  color: #fff;
  padding: 10px 14px;
  max-width: min(92vw, 420px);
}

.dialog {
  border: 1px solid #dfd5c8;
  border-radius: 18px;
  padding: 0;
  width: min(520px, calc(100vw - 24px));
  box-shadow: 0 24px 50px rgba(42, 33, 18, 0.22);
}

.dialog.compact {
  width: min(430px, calc(100vw - 24px));
}

.dialog::backdrop {
  background: rgba(32, 27, 21, 0.34);
}

.dialog-form {
  margin: 0;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.dialog-form h3 {
  margin: 0;
  font-size: 22px;
  font-family: 'Manrope', sans-serif;
}

label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #d8cec0;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.stack-block {
  display: grid;
  gap: 8px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .auth-area,
  .login-panel {
    justify-items: start;
  }

  .user-box {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .shell {
    width: calc(100% - 14px);
    margin: 10px auto 20px;
  }

  h1 {
    font-size: 26px;
  }

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

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions .btn {
    flex: 1;
  }

  .board {
    grid-template-columns: 1fr;
  }

  .dialog {
    width: calc(100vw - 14px);
  }
}
