:root {
  --ink: #111827;
  --muted: #6b7280;
  --line: #e8e6f1;
  --purple: #7c3cff;
  --purple-dark: #5a25db;
  --cyan: #22c9d6;
  --rose: #ff3f68;
  --green: #13a950;
  --blue: #168af0;
  --panel: #ffffff;
  --soft: #f6f4fb;
  --shadow: 0 16px 44px rgba(86, 55, 155, .16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, Arial, sans-serif;
  background: #fff;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width, 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 20px 12px;
  color: #6646a3;
  background: linear-gradient(180deg, #fbfaff 0%, #f6f0ff 100%);
  border-right: 1px solid #ebe7f6;
  z-index: 5;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: ew-resize;
  z-index: 6;
  touch-action: none;
}

.sidebar-resizer:hover,
.sidebar-resizer.active {
  background: rgba(124, 60, 255, .25);
}

.sidebar.expanded .nav-item,
.sidebar.expanded .side-action,
.sidebar.expanded .logout-btn {
  grid-auto-flow: column;
  grid-template-columns: auto 1fr;
  justify-content: start;
  justify-items: start;
  align-items: center;
  gap: 12px;
  padding-left: 10px;
  min-height: 48px;
  width: 100%;
}

.sidebar.expanded .nav-item small,
.sidebar.expanded .side-action small,
.sidebar.expanded .logout-btn small {
  font-size: 14px;
  white-space: nowrap;
}

.sidebar.expanded .site-brand strong {
  max-width: none;
}

.site-brand {
  width: 54px;
  display: grid;
  justify-items: center;
  gap: 4px;
  color: #452398;
  text-decoration: none;
}

.site-brand img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 8px 18px rgba(83, 65, 171, .18);
}

.site-brand strong {
  max-width: 60px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
}

.rail-toggle,
.bell,
.nav-item,
.side-action,
.quick-card,
.avatar,
.icon-btn,
.filter-btn,
.peek-btn,
.float-help,
.close-btn,
.design-choice {
  border: 0;
  background: transparent;
}

.rail-toggle {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  gap: 4px;
}

.rail-toggle span {
  width: 17px;
  height: 14px;
  border: 2px solid #7655b7;
  border-radius: 4px;
  display: block;
}

.rail-toggle span + span { display: none; }

.side-action {
  color: #572fc4;
  display: grid;
  justify-items: center;
  gap: 7px;
}

.plus {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 31px;
  line-height: 1;
  background: linear-gradient(135deg, #8d4dff, #6b30f6);
  box-shadow: 0 8px 16px rgba(124, 60, 255, .28);
}

.side-nav {
  display: grid;
  gap: 10px;
  width: 100%;
}

.nav-item {
  min-height: 62px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  color: #6646a3;
  border-radius: 12px;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  background-color: #eee8ff;
}

.nav-item small,
.side-action small {
  font-size: 13px;
  font-weight: 500;
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: block;
  position: relative;
  border-radius: 9px;
}

.logout-btn {
  min-height: 62px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  color: #b91c1c;
  border-radius: 12px;
  width: 100%;
}

.logout-btn:hover { color: #7f1d1d; }

.logout-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #b91c1c;
  background: #fff1f2;
}

.logout-btn small { font-size: 13px; font-weight: 500; }

.home-icon::before {
  content: "";
  position: absolute;
  inset: 7px 6px 5px;
  background: #7c3cff;
  clip-path: polygon(50% 0, 100% 38%, 100% 100%, 0 100%, 0 38%);
}

.folder-icon::before {
  content: "";
  position: absolute;
  inset: 8px 4px 6px;
  border: 2px solid #7051ad;
  border-radius: 4px;
}

.folder-icon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  width: 9px;
  height: 5px;
  border: 2px solid #7051ad;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}

.template-icon::before {
  content: "";
  position: absolute;
  inset: 5px 7px;
  border: 2px solid #7051ad;
  border-radius: 5px;
  box-shadow: inset 8px 0 0 transparent;
}

.brand-icon::before {
  content: "co";
  position: absolute;
  inset: 6px 3px;
  display: grid;
  place-items: center;
  border: 2px solid #7051ad;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
}

.ai-icon::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 2px solid #7051ad;
  border-top-color: transparent;
  border-radius: 50%;
}

.dots-icon::before {
  content: "...";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #7051ad;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 1px;
}

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 24px;
  justify-items: center;
}

.bell {
  width: 34px;
  height: 34px;
  position: relative;
}

.bell::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 8px;
  width: 14px;
  height: 15px;
  border: 2px solid #7051ad;
  border-radius: 10px 10px 5px 5px;
}

.bell::after {
  content: "";
  position: absolute;
  left: 13px;
  bottom: 5px;
  width: 8px;
  height: 2px;
  background: #7051ad;
  border-radius: 4px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: #078b25;
  font-weight: 800;
}

.app-shell {
  margin-left: var(--sidebar-width, 80px);
  min-height: 100vh;
  padding: 10px 28px 80px;
}

.hero {
  min-height: 420px;
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 4%, rgba(40, 210, 212, .32), transparent 31%),
    radial-gradient(circle at 84% 3%, rgba(146, 92, 255, .33), transparent 34%),
    linear-gradient(180deg, #f7f9ff 0%, #fff 78%);
}

.hero-inner {
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: 68px 32px 38px;
  display: grid;
  justify-items: center;
}

.hero h1 {
  margin: 4px 0 25px;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.08;
  color: #5235ee;
  font-weight: 800;
  letter-spacing: 0;
}

.peek-btn {
  position: absolute;
  right: 28px;
  top: 20px;
  height: 44px;
  padding: 0 22px 0 44px;
  border: 1px solid rgba(124, 60, 255, .28);
  border-radius: 24px;
  color: #6d31db;
  background: rgba(255, 255, 255, .48);
  font-weight: 700;
}

.peek-btn::before,
.peek-btn::after {
  content: "";
  position: absolute;
  background: #7c3cff;
  transform: rotate(45deg);
}

.peek-btn::before {
  width: 13px;
  height: 13px;
  left: 18px;
  top: 12px;
}

.peek-btn::after {
  width: 8px;
  height: 8px;
  left: 15px;
  top: 25px;
}

.search-wrap {
  width: min(900px, 92vw);
  height: 74px;
  position: relative;
}

.search-wrap input {
  width: 100%;
  height: 100%;
  padding: 0 28px 0 60px;
  border: 1.5px solid #8b42ff;
  border-radius: 22px;
  outline: 0;
  color: #343746;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 16px 42px rgba(96, 63, 171, .11);
  font-size: 17px;
}

.search-icon {
  position: absolute;
  left: 25px;
  top: 25px;
  width: 18px;
  height: 18px;
  border: 2px solid #111;
  border-radius: 50%;
  z-index: 1;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: -5px;
  width: 8px;
  height: 2px;
  background: #111;
  transform: rotate(45deg);
  border-radius: 2px;
}

.quick-grid {
  width: min(1460px, 100%);
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 18px;
  align-items: start;
}

.quick-card {
  min-height: 92px;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 12px;
  color: #222939;
  font-size: 14px;
  font-weight: 600;
  border-radius: 10px;
  padding: 0;
}

.quick-card:hover .quick-icon {
  transform: translateY(-2px);
}

.quick-card[data-kind="magic"]:hover .quick-icon {
  transform: rotate(45deg) translateY(-2px);
}

.quick-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  position: relative;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 9px 16px rgba(20, 28, 54, .08);
  transition: transform .16s ease;
}

.quick-icon::before {
  content: attr(data-mark);
  font-size: 23px;
  font-weight: 900;
}

.quick-card[data-kind="magic"] .quick-icon {
  border-radius: 12px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #8b49ff, #38d7e2);
}

.quick-card[data-kind="magic"] .quick-icon::before {
  transform: rotate(-45deg);
  font-size: 17px;
}

.quick-card[data-kind="photo"] .quick-icon {
  border-radius: 12px;
  background:
    linear-gradient(rgba(0,0,0,.05), rgba(0,0,0,.16)),
    url("https://images.unsplash.com/photo-1527980965255-d3b416303d12?auto=format&fit=crop&w=140&q=80") center/cover;
}

.quick-card[data-kind="neutral"] .quick-icon {
  color: #111827;
  background: #f1f2f5;
}

.badge {
  position: absolute;
  top: -12px;
  right: -8px;
  padding: 2px 7px;
  border-radius: 7px;
  color: #fff;
  background: #813dff;
  font-size: 12px;
  font-weight: 800;
}

.recents-section {
  width: min(1720px, 100%);
  margin: -6px auto 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 8px 18px;
}

h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

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

.filter-btn {
  height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border: 1px solid #e0ddea;
  border-radius: 22px;
  background: #fff;
  font-weight: 500;
  box-shadow: 0 2px 7px rgba(22, 28, 45, .04);
}

.filter-btn span {
  width: 8px;
  height: 8px;
  border-right: 2px solid #111;
  border-bottom: 2px solid #111;
  transform: rotate(45deg) translateY(-2px);
}

.icon-btn {
  width: 44px;
  height: 44px;
  position: relative;
  border-radius: 50%;
}

.sort-btn::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 11px;
  width: 2px;
  height: 21px;
  background: #111;
  box-shadow: 13px 0 0 #111;
}

.sort-btn::after {
  content: "v";
  position: absolute;
  left: 8px;
  top: 8px;
  color: #111;
  font-size: 24px;
  transform: rotate(180deg);
}

.list-btn::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 13px;
  width: 18px;
  height: 3px;
  background: #111;
  box-shadow: 0 8px 0 #111, 0 16px 0 #111;
}

.list-btn::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 13px;
  width: 4px;
  height: 4px;
  background: #111;
  border-radius: 50%;
  box-shadow: 0 8px 0 #111, 0 16px 0 #111;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(190px, 1fr));
  gap: 26px;
  padding: 0 8px;
}

.design-card {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.delete-recent {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(17, 24, 39, .08);
  border-radius: 50%;
  color: #111827;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 8px 18px rgba(17, 24, 39, .16);
  z-index: 2;
}

.delete-recent::before,
.delete-recent::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

.delete-recent::before {
  transform: rotate(45deg);
}

.delete-recent::after {
  transform: rotate(-45deg);
}

.delete-recent:hover,
.delete-recent:focus-visible {
  color: #fff;
  background: #ef4444;
  outline: none;
}

.thumb {
  height: 202px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #f2f3f5;
}

.folder-thumb {
  position: relative;
  background: #e9ecef;
}

.saved-thumb {
  padding: 18px;
}

.saved-thumb img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 2px 8px rgba(28, 35, 50, .15);
}

.folder-thumb::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 46%;
  height: 28px;
  border-radius: 8px 12px 0 0;
  background: #dfe3e7;
}

.folder-thumb::after {
  content: "";
  position: absolute;
  inset: 28px 0 0;
  border-top: 2px solid #fff;
  background: #e9ecef;
}

.upload-cloud,
.float-help::before {
  width: 28px;
  height: 20px;
  position: relative;
  z-index: 1;
  border: 3px solid currentColor;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  color: #111827;
}

.upload-cloud::before,
.float-help::after {
  content: "";
  position: absolute;
  left: 3px;
  top: -12px;
  width: 22px;
  height: 22px;
  border: 3px solid currentColor;
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
}

.paper {
  width: 65%;
  height: 84%;
  background: #fff;
  border: 1px solid #d8dce5;
  box-shadow: 0 2px 8px rgba(28, 35, 50, .15);
}

.doc-scan {
  width: 62%;
  height: 84%;
  padding: 18px 15px;
  background: #fff;
  border: 1px solid #d8dce5;
  box-shadow: 0 2px 8px rgba(28, 35, 50, .14);
}

.doc-scan .id-line,
.doc-scan .id-photo,
.portrait .tie,
.portrait .face,
.portrait .body {
  display: block;
}

.id-line {
  height: 7px;
  margin-bottom: 7px;
  background: #b8becb;
}

.id-photo {
  width: 66%;
  height: 42px;
  margin: 11px auto 10px;
  background: linear-gradient(135deg, #95b86d, #e0b37f);
}

.portrait {
  width: 65%;
  height: 92%;
  position: relative;
  align-self: end;
  background: #f6f7f9;
  overflow: hidden;
}

.portrait .face {
  width: 72px;
  height: 88px;
  position: absolute;
  left: calc(50% - 36px);
  top: 18px;
  border-radius: 40% 40% 46% 46%;
  background: #c58a64;
}

.portrait .body {
  position: absolute;
  left: 17%;
  right: 17%;
  bottom: 0;
  height: 88px;
  border-radius: 38px 38px 0 0;
  background: #1d315b;
}

.portrait .tie {
  position: absolute;
  left: calc(50% - 8px);
  bottom: 0;
  width: 16px;
  height: 70px;
  background: #111;
  clip-path: polygon(50% 0, 100% 18%, 74% 100%, 26% 100%, 0 18%);
  z-index: 2;
}

.card-title {
  margin: 12px 0 6px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
}

.meta-dot {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: #7c3cff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 900;
}

.float-help {
  position: fixed;
  right: 46px;
  bottom: 26px;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #9345ff, #6b30f6);
  box-shadow: 0 18px 30px rgba(124, 60, 255, .26);
  z-index: 4;
}

.float-help::before {
  content: "";
  width: 22px;
  height: 16px;
  color: #fff;
  border-width: 2px;
}

.float-help::after {
  width: 8px;
  height: 8px;
  left: 32px;
  top: 17px;
  color: #fff;
  border-width: 2px;
  background: #9345ff;
  transform: rotate(45deg);
}

.modal {
  width: min(620px, calc(100vw - 28px));
  border: 0;
  border-radius: 16px;
  padding: 0;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(13, 18, 32, .34);
  backdrop-filter: blur(4px);
}

.modal form { margin: 0; }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 24px 12px;
}

.modal h3 { margin: 0; font-size: 23px; }

.close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f1eff8;
  font-weight: 800;
}

.modal-body {
  display: grid;
  gap: 12px;
  padding: 12px 24px 24px;
}

.design-choice {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid #ece9f5;
  border-radius: 10px;
  background: #fff;
  text-align: left;
}

.design-choice:hover {
  border-color: #cbbdff;
  background: #faf8ff;
}

.design-choice strong { display: block; }
.design-choice small { color: var(--muted); }

.size-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.size-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 600;
}

.size-form input,
.size-form select {
  height: 46px;
  border: 1px solid #dcd8e9;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}

.unit-field {
  grid-column: 1 / -1;
}

.primary-btn {
  height: 46px;
  grid-column: 1 / -1;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: #7c3cff;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 18px);
  max-width: min(560px, calc(100vw - 32px));
  padding: 13px 18px;
  border-radius: 12px;
  color: #fff;
  background: #1f2937;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1240px) {
  .quick-grid { grid-template-columns: repeat(7, minmax(72px, 1fr)); }
  .hero { min-height: 520px; }
  .cards-grid { grid-template-columns: repeat(3, minmax(190px, 1fr)); }
}

@media (max-width: 780px) {
  .sidebar {
    width: 64px;
    padding-inline: 8px;
  }

  .nav-item small,
  .side-action small { font-size: 11px; }

  .app-shell {
    margin-left: 64px;
    padding: 8px 12px 80px;
  }

  .hero {
    min-height: 640px;
    border-radius: 16px;
  }

  .hero-inner { padding: 70px 16px 26px; }
  .hero h1 { text-align: center; }
  .peek-btn { right: 14px; }
  .quick-grid { grid-template-columns: repeat(3, minmax(72px, 1fr)); gap: 14px; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .filters { flex-wrap: wrap; }
  .cards-grid { grid-template-columns: 1fr; }
  .thumb { height: 190px; }
  .float-help { right: 20px; }
}
