:root {
  --navy: #172033;
  --text: #1d2433;
  --muted: #7c8496;
  --line: #e8eaf0;
  --surface: #ffffff;
  --page: #f7f8fb;
  --primary: #635bdb;
  --primary-soft: #efefff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--page);
  font-family: "DM Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sidebar {
  position: fixed;
  z-index: 20;
  inset: 0 auto 0 0;
  width: 248px;
  display: flex;
  flex-direction: column;
  padding: 24px 18px 20px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.sidebar-overlay { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 10px 28px;
  color: var(--navy);
  text-decoration: none;
  font-family: "Manrope", sans-serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--primary);
  border-radius: 9px;
  box-shadow: 0 7px 15px rgba(99,91,219,.18);
}
.brand-mark svg { width: 20px; }

.nav { display: grid; gap: 5px; }
.nav-item {
  width: 100%;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 9px;
  padding: 0 12px;
  color: #666f82;
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
}
.nav-item svg { width: 20px; height: 20px; }
.nav-item:hover { background: #f7f7fb; color: var(--primary); }
.nav-item.active { color: var(--primary); background: var(--primary-soft); }
.nav-count {
  margin-left: auto;
  min-width: 25px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--primary);
  background: #e2e1fb;
  font-size: 11px;
}

.sidebar-footer { margin-top: auto; padding: 14px 10px 2px; }
.storage-head { display: flex; justify-content: space-between; font-size: 12px; }
.storage-head strong { color: var(--primary); }
.progress { height: 5px; margin: 9px 0 8px; overflow: hidden; border-radius: 99px; background: #eceef3; }
.progress span { display: block; width: 68%; height: 100%; border-radius: inherit; background: var(--primary); }
.sidebar-footer p { margin: 0; color: var(--muted); font-size: 11px; }

.main { margin-left: 248px; min-height: 100vh; }
.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 34px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
}
.search {
  width: min(470px, 45vw);
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
}
.search svg { width: 18px; color: #9299a8; }
.search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13px; }
.search input::placeholder { color: #a1a7b4; }
.search kbd { color: #9da3af; font-family: inherit; font-size: 11px; border: 1px solid #e2e4e9; border-radius: 5px; padding: 3px 6px; background: white; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-button {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: #747d8f;
  background: transparent;
}
.icon-button:hover { background: #f3f4f7; }
.icon-button svg { width: 20px; height: 20px; }
.notification-dot { position: absolute; right: 8px; top: 8px; width: 7px; height: 7px; border: 2px solid white; border-radius: 50%; background: #f56d6d; }
.menu-button { display: none; }
.profile { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; color: var(--text); text-align: left; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: white; background: #ee8c72; font-size: 12px; font-weight: 700; }
.profile-copy { display: grid; line-height: 1.2; }
.profile-copy strong { font-size: 12px; }
.profile-copy small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.profile > svg { width: 16px; }

.content { max-width: 1440px; margin: 0 auto; padding: 32px 34px 50px; }
.title-row { display: flex; align-items: center; justify-content: space-between; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 12px; }
h1, h2 { margin: 0; font-family: "Manrope", sans-serif; }
h1 { font-size: 25px; letter-spacing: -0.7px; }
h2 { font-size: 16px; }
.primary-button {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  padding: 0 15px;
  color: white;
  background: var(--primary);
  box-shadow: 0 7px 16px rgba(99,91,219,.16);
  font-size: 13px;
  font-weight: 700;
}
.primary-button:hover { background: #5850c9; }
.primary-button svg { width: 17px; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 25px; }
.stat-card { height: 104px; display: flex; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.stat-icon { width: 48px; height: 48px; display: grid; flex: 0 0 48px; place-items: center; border-radius: 10px; }
.stat-icon svg { width: 23px; }
.stat-icon.indigo { color: #6660d6; background: #efeffe; }
.stat-icon.coral { color: #dc7c68; background: #fff0ec; }
.stat-icon.yellow { color: #c58b32; background: #fff6df; }
.stat-card div { display: grid; }
.stat-card p { margin: 0 0 3px; color: var(--muted); font-size: 12px; }
.stat-card strong { font-family: "Manrope", sans-serif; font-size: 22px; line-height: 1.1; }
.stat-card small { margin-top: 5px; color: #9aa0ae; font-size: 10px; }
.stat-card small b { color: #50a779; }

.section-block { margin-top: 28px; }
.section-heading { height: 34px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.text-button { border: 0; color: var(--primary); background: transparent; font-size: 12px; font-weight: 700; }
.text-button span { margin-left: 3px; }
.folder-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.folder-card { position: relative; min-width: 0; height: 78px; display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: white; text-align: left; }
.folder-card:hover { border-color: #d8d9e6; box-shadow: 0 7px 18px rgba(32,38,53,.05); transform: translateY(-1px); }
.folder-icon { width: 42px; height: 42px; display: grid; flex: 0 0 42px; place-items: center; border-radius: 9px; }
.folder-icon svg { width: 23px; }
.folder-icon.blue { color: #6875d8; background: #edf0ff; }
.folder-icon.purple { color: #9a71d2; background: #f4edff; }
.folder-icon.green { color: #55a57e; background: #eaf7f0; }
.folder-icon.orange { color: #d08a5c; background: #fff1e7; }
.folder-info { min-width: 0; display: grid; }
.folder-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.folder-info small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.more { position: absolute; right: 10px; top: 9px; color: #a1a6b1; font-size: 10px; letter-spacing: 1px; }

.documents-section { margin-top: 24px; }
.view-actions { display: flex; gap: 3px; }
.icon-button.small { width: 32px; height: 32px; border: 1px solid transparent; }
.icon-button.small svg { width: 16px; }
.icon-button.small.active { border-color: var(--line); background: white; color: var(--primary); }
.documents-section.grid-view .table-wrap { border: 0; background: transparent; }
.documents-section.grid-view table,
.documents-section.grid-view tbody { display: grid; }
.documents-section.grid-view table { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.documents-section.grid-view thead { display: none; }
.documents-section.grid-view tbody { display: contents; }
.documents-section.grid-view tbody tr {
  position: relative;
  min-width: 0;
  min-height: 112px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}
.documents-section.grid-view tbody td { height: auto; border: 0; }
.documents-section.grid-view tbody td:nth-child(2),
.documents-section.grid-view tbody td:nth-child(3),
.documents-section.grid-view tbody td:nth-child(4) { display: none; }
.documents-section.grid-view tbody td:first-child { padding: 16px 8px 16px 16px; }
.documents-section.grid-view tbody td:last-child { width: auto; padding: 16px 10px 16px 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: white; }
table { width: 100%; border-collapse: collapse; }
th { height: 42px; color: #9299a7; background: #fafbfc; font-size: 10px; font-weight: 600; text-align: left; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { width: 50px; padding-right: 10px; }
td { height: 64px; border-top: 1px solid #f0f1f4; color: #697184; font-size: 11px; }
.document-name { display: flex; align-items: center; gap: 10px; }
.document-name > div { display: grid; }
.document-name strong { color: var(--text); font-size: 12px; }
.document-name small { margin-top: 4px; color: #a0a6b3; font-size: 9px; }
.file-icon { width: 34px; height: 38px; display: grid; flex: 0 0 34px; place-items: center; border-radius: 6px; color: white; font-family: "Manrope", sans-serif; font-size: 10px; font-weight: 800; }
.file-icon.doc { background: #6684d8; }
.file-icon.sheet { background: #53a479; }
.file-icon.slide { background: #dc805c; }
.file-icon.pdf { background: #e26969; font-size: 8px; }
.owner { display: flex; align-items: center; gap: 7px; }
.mini-avatar { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; color: white; font-size: 9px; font-weight: 700; }
.blue-avatar { background: #7186d7; }.pink-avatar { background: #d98a94; }.green-avatar { background: #65a88b; }.yellow-avatar { background: #d7a75e; }
.status { display: inline-flex; height: 24px; align-items: center; border-radius: 99px; padding: 0 9px; font-size: 9px; font-weight: 700; }
.status.draft { color: #c17a39; background: #fff3e5; }
.status.complete { color: #4b9672; background: #eaf7ef; }
.status.review { color: #6861c8; background: #efefff; }
.row-more { border: 0; color: #a1a6b1; background: transparent; letter-spacing: 1px; }

.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(20,25,38,.35); backdrop-filter: blur(3px); }
.modal-backdrop[hidden] { display: none; }
.modal { position: relative; width: min(430px, 100%); border-radius: 14px; padding: 28px; background: white; box-shadow: 0 24px 60px rgba(20,25,38,.18); text-align: center; }
.modal-close { position: absolute; right: 12px; top: 10px; width: 30px; height: 30px; border: 0; border-radius: 50%; color: #9299a7; background: transparent; font-size: 22px; }
.modal-icon { width: 48px; height: 48px; display: grid; margin: 0 auto 12px; place-items: center; border-radius: 12px; color: white; background: var(--primary); }
.modal-icon svg { width: 24px; }
.modal h2 { font-size: 19px; }
.modal p { margin: 8px 0 20px; color: var(--muted); font-size: 12px; }
.document-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.document-types button { display: grid; place-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 9px; padding: 14px 8px; background: white; }
.document-types button:hover { border-color: #cfcfeb; background: #fafaff; }
.document-types strong { font-size: 11px; }
.toast { position: fixed; z-index: 60; right: 24px; bottom: 24px; max-width: 300px; transform: translateY(20px); opacity: 0; pointer-events: none; border-radius: 8px; padding: 12px 15px; color: white; background: var(--navy); box-shadow: 0 12px 30px rgba(20,25,38,.16); font-size: 12px; transition: .25s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.editor-modal { width: min(920px, calc(100vw - 32px)); height: min(720px, calc(100vh - 32px)); display: grid; grid-template-rows: auto auto 1fr; overflow: hidden; border-radius: 14px; background: white; box-shadow: 0 24px 60px rgba(20,25,38,.18); text-align: left; }
.editor-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.editor-header p { margin: 0 0 4px; color: var(--primary); font-size: 10px; font-weight: 700; }
.editor-header input { width: min(520px, 55vw); border: 0; outline: 0; color: var(--text); font-family: "Manrope", sans-serif; font-size: 18px; font-weight: 800; }
.editor-actions { display: flex; align-items: center; gap: 8px; }
.secondary-button { height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 0 15px; color: var(--text); background: white; font-size: 13px; font-weight: 700; }
.editor-toolbar { height: 44px; display: flex; align-items: center; gap: 4px; padding: 6px 20px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.editor-toolbar button { min-width: 32px; height: 32px; border: 0; border-radius: 6px; color: #60697a; background: transparent; font-size: 12px; }
.editor-toolbar button:hover { background: #eceef4; }
.editor-toolbar span { width: 1px; height: 20px; margin: 0 4px; background: var(--line); }
.document-editor { overflow-y: auto; margin: 24px auto; width: min(720px, calc(100% - 48px)); min-height: 0; border: 1px solid #edf0f4; border-radius: 4px; padding: 34px 46px; outline: 0; box-shadow: 0 5px 18px rgba(38,44,60,.04); color: #303746; font-size: 15px; line-height: 1.75; }
.document-editor:focus { border-color: #d8d7ef; }

@media (max-width: 1050px) {
  .sidebar { width: 210px; }
  .main { margin-left: 210px; }
  .folder-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-copy { display: none; }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: 12px 0 30px rgba(30,35,50,.12); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { position: fixed; z-index: 19; inset: 0; border: 0; background: rgba(23,32,51,.28); }
  .sidebar.open + .sidebar-overlay { display: block; }
  .main { margin-left: 0; }
  .topbar { height: 68px; padding: 0 16px; }
  .menu-button { display: grid; }
  .search { width: auto; flex: 1; }
  .search kbd { display: none; }
  .profile > svg { display: none; }
  .content { padding: 24px 16px 40px; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { height: 92px; }
  .folder-grid { grid-template-columns: 1fr 1fr; }
  th:nth-child(2), td:nth-child(2), th:nth-child(4), td:nth-child(4) { display: none; }
}
@media (max-width: 520px) {
  .top-actions .icon-button { display: none; }
  .title-row { align-items: flex-end; }
  h1 { font-size: 21px; }
  .eyebrow { display: none; }
  .primary-button { width: 42px; padding: 0; justify-content: center; }
  .primary-button { font-size: 0; }
  .folder-grid { grid-template-columns: 1fr; }
  th:nth-child(3), td:nth-child(3) { display: none; }
  .document-types { grid-template-columns: 1fr; }
  .documents-section.grid-view table { grid-template-columns: 1fr; }
}

.free-label { height: 32px; display: inline-flex; align-items: center; border-radius: 99px; padding: 0 12px; color: #3d9869; background: #edf8f2; font-size: 11px; font-weight: 800; }
.top-actions .avatar { border: 0; }
.free-badge { display: inline-flex; height: 25px; align-items: center; border-radius: 99px; padding: 0 9px; color: #4d956e; background: #edf8f2; font-size: 9px; font-weight: 800; letter-spacing: .5px; }
.sidebar-footer p { margin-top: 8px; line-height: 1.5; }
.hero { min-height: 220px; display: flex; align-items: center; justify-content: space-between; overflow: hidden; border-radius: 16px; padding: 38px 44px; color: white; background: linear-gradient(125deg,#171e38 0%,#343a74 58%,#665ed1 100%); }
.hero-kicker { display: inline-block; margin-bottom: 10px; color: #cbc9ff; font-size: 10px; font-weight: 800; letter-spacing: 1.2px; }
.hero h1 { max-width: 650px; margin: 0; color: white; font-size: 38px; line-height: 1.15; }
.hero p { max-width: 610px; margin: 14px 0 0; color: #cfd3e8; font-size: 13px; line-height: 1.7; }
.hero-stat { width: 145px; height: 145px; display: grid; place-content: center; text-align: center; flex: 0 0 145px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; background: rgba(255,255,255,.08); }
.hero-stat strong { font-family:"Manrope",sans-serif; font-size: 38px; }
.hero-stat span { margin-top: 2px; color: #d8daf0; font-size: 11px; }
.ad-slot { min-height: 72px; display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0; border: 1px dashed #d9dde7; border-radius: 8px; color: #9aa2af; background: #fbfcfd; font-size: 10px; }
.ad-label { border: 1px solid #dfe3ea; border-radius: 4px; padding: 3px 5px; color: #adb4bf; font-size: 8px; letter-spacing: .6px; }
.category-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 12px; }
.category-card { position: relative; min-height: 112px; display: grid; align-content: end; gap: 4px; border: 1px solid var(--line); border-radius: 11px; padding: 14px; background: white; text-align: left; transition: .2s ease; }
.category-card:hover { transform: translateY(-2px); border-color: #d2d2ee; box-shadow: 0 10px 24px rgba(38,44,60,.06); }
.category-icon { position: absolute; right: 12px; top: 12px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: #6860d2; background: #efefff; font-size: 9px; font-weight: 800; }
.category-card strong { margin-top: 32px; font-size: 12px; }
.category-card small { color: var(--muted); font-size: 9px; }
.category-arrow { position:absolute; right:12px; bottom:12px; color:#969dab; font-size:11px; }
.cat-1 .category-icon,.cat-6 .category-icon { color:#cf795f;background:#fff0eb; }
.cat-2 .category-icon,.cat-7 .category-icon { color:#4c9b78;background:#edf8f2; }
.cat-3 .category-icon,.cat-8 .category-icon { color:#4e79c4;background:#edf3fd; }
.cat-4 .category-icon,.cat-9 .category-icon { color:#b18346;background:#fff6df; }
.template-heading { margin-top: 22px; }
.template-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.template-card { position: relative; min-height: 145px; display: grid; grid-template-columns: 58px 1fr; grid-template-rows: 1fr auto; align-items: center; gap: 12px; border:1px solid var(--line); border-radius:11px; padding:14px; background:white; text-align:left; transition:.2s ease; }
.template-card:hover { border-color:#cbcbed; box-shadow:0 10px 24px rgba(38,44,60,.06); transform:translateY(-2px); }
.template-preview-icon { width:58px;height:74px;display:grid;place-items:center;border:1px solid #e5e7ef;border-radius:5px;color:#7770cf;background:linear-gradient(150deg,#fff 68%,#efefff 68%);font-family:"Manrope",sans-serif;font-size:10px;font-weight:800;box-shadow:0 5px 12px rgba(38,44,60,.06); }
.template-card-copy { min-width:0;display:grid;gap:5px; }
.template-card-copy strong { line-height:1.35;font-size:12px; }
.template-card-copy small { color:var(--muted);font-size:9px; }
.free-chip { position:absolute;right:10px;top:10px;border-radius:99px;padding:4px 7px;color:#49966c;background:#edf8f2;font-size:8px;font-weight:800; }
.template-card-arrow { grid-column:1/-1;border-top:1px solid #f0f1f4;padding-top:9px;color:var(--primary);font-size:10px;font-weight:800; }
.category-banner { min-height:150px;display:flex;align-items:center;justify-content:space-between;border-radius:14px;padding:28px 34px;color:white;background:linear-gradient(120deg,#1c2440,#5755b5); }
.category-banner h1 { margin:3px 0 7px;color:white;font-size:30px; }
.category-banner p:last-child { margin:0;color:#d8dbef;font-size:12px; }
.category-banner .eyebrow { color:#c9c9ff; }
.category-total { width:92px;height:92px;display:grid;place-content:center;text-align:center;border:1px solid rgba(255,255,255,.14);border-radius:50%;background:rgba(255,255,255,.07); }
.category-total strong { font-family:"Manrope",sans-serif;font-size:28px; }
.category-total span { color:#d8daf0;font-size:9px; }

.modal-open { overflow:hidden; }
.template-workspace { width:min(1180px,calc(100vw - 32px));height:min(820px,calc(100vh - 32px));overflow:hidden;border-radius:14px;background:white;box-shadow:0 24px 70px rgba(20,25,38,.22); }
.workspace-header { height:72px;display:flex;align-items:center;justify-content:space-between;padding:0 20px 0 24px;border-bottom:1px solid var(--line); }
.workspace-header p { margin:0 0 3px;color:var(--primary);font-size:9px;font-weight:800;text-transform:uppercase;letter-spacing:.7px; }
.workspace-header h2 { font-size:17px; }
.workspace-header .modal-close { position:static; }
.workspace-grid { height:calc(100% - 72px);display:grid;grid-template-columns:355px 1fr; }
.form-panel { overflow-y:auto;border-right:1px solid var(--line);padding:18px 20px 30px;background:#fcfcfd; }
.form-heading { display:flex;justify-content:space-between;align-items:center;margin-bottom:12px; }
.form-heading strong { font-size:12px; }
.form-heading button { border:0;color:var(--primary);background:transparent;font-size:10px;font-weight:800; }
#templateForm { display:grid;gap:11px; }
#templateForm label { display:grid;gap:5px;color:#697184;font-size:10px;font-weight:700; }
#templateForm input,#templateForm textarea { width:100%;border:1px solid #e3e6ec;border-radius:7px;outline:0;padding:9px 10px;color:var(--text);background:white;font-size:11px; }
#templateForm input { height:38px; }
#templateForm textarea { resize:vertical;min-height:70px;line-height:1.5; }
#templateForm input:focus,#templateForm textarea:focus { border-color:#aaa6ea;box-shadow:0 0 0 3px #efefff; }
.preview-panel { min-width:0;display:grid;grid-template-rows:44px minmax(0,1fr) 58px 64px;background:#f2f3f7; }
.preview-toolbar { display:flex;align-items:center;justify-content:space-between;padding:0 18px;border-bottom:1px solid var(--line);background:white;font-size:10px;font-weight:800; }
.preview-toolbar span:last-child { color:#64a381;font-size:9px;font-weight:600; }
.document-scroll { overflow:auto;padding:22px; }
.document-page { width:min(680px,100%);min-height:850px;margin:0 auto;padding:48px 54px;color:#263044;background:white;box-shadow:0 8px 28px rgba(38,44,60,.12);font-family:"Times New Roman",serif;font-size:12px;line-height:1.55; }
.download-bar { display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:10px 18px;border-top:1px solid var(--line);background:white; }
.download-button { height:40px;border:0;border-radius:7px;padding:0 14px;color:white;background:#625bd4;font-size:11px;font-weight:800; }
.download-button.outline { color:#625bd4;border:1px solid #625bd4;background:white; }
.ad-preview { margin:0;border-width:1px 0 0;border-radius:0;background:#fafbfc; }

.document-letter-head { text-align:center;margin-bottom:28px; }
.letter-line { width:50px;height:4px;margin:0 auto 14px;background:#6260c9; }
.document-letter-head h1 { font-family:"Manrope",sans-serif;font-size:19px;letter-spacing:.5px; }
.document-letter-head p { margin:5px 0;color:#667085;font-size:11px; }
.identity-grid { display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:18px 0;border:1px solid #e5e7eb;border-radius:5px;padding:12px;background:#fafbfc; }
.identity-grid div { display:grid;gap:2px;border-bottom:1px solid #eceef2;padding:5px; }
.identity-grid span { color:#8b92a1;font-size:9px;text-transform:uppercase;letter-spacing:.4px; }
.identity-grid strong { font-size:11px; }
.report-section { margin-top:16px; }
.report-section h2 { font-family:"Manrope",sans-serif;font-size:12px;text-transform:uppercase;letter-spacing:.3px;border-bottom:1px solid #dde1e8;padding-bottom:5px; }
.report-section p { min-height:18px;margin:7px 0 0;text-align:justify;white-space:normal; }
.letter-head { text-align:center;font-family:"Manrope",sans-serif; }
.letter-head strong { font-size:15px; }
.letter-head p { margin:2px 0;font-size:9px; }
.letter-meta { display:grid;grid-template-columns:1fr 1fr;gap:6px 20px;margin:18px 0; }
.letter-meta div { display:flex;justify-content:space-between;border-bottom:1px solid #edf0f3;font-size:10px; }
.letter-meta span { color:#898f9d; }
.letter-address { margin-top:20px;font-size:11px; }
.letter-address p { margin:2px 0; }
.letter-greeting { margin-top:18px; }
.letter-body { min-height:180px;text-align:justify; }
.letter-close { margin-top:14px; }
.letter-sign { width:220px;margin:30px 0 0 auto;text-align:center; }
.letter-sign p { margin:2px 0;font-size:10px; }
.letter-sign strong,.letter-sign span { display:block; }
.signature-space { height:65px; }
.invoice-head { display:flex;justify-content:space-between;align-items:flex-start;padding-bottom:18px;border-bottom:3px solid #343951; }
.invoice-brand { font-family:"Manrope",sans-serif;font-size:30px;font-weight:800;letter-spacing:2px;color:#6260c9; }
.invoice-head p { margin:4px 0;font-size:10px; }
.invoice-date { text-align:right; }
.invoice-date p { color:#898f9d;font-size:9px;text-transform:uppercase; }
.invoice-party { margin:24px 0; }
.invoice-party p { color:#898f9d;font-size:9px; }
.invoice-party strong,.invoice-party span { display:block; }
.invoice-table { width:100%;border-collapse:collapse;margin:20px 0; }
.invoice-table th { padding:8px;text-align:left;color:white;background:#343951;font-size:9px; }
.invoice-table td { border-bottom:1px solid #e6e8ed;padding:10px 8px;font-size:10px; }
.invoice-totals { width:260px;margin-left:auto; }
.invoice-totals div { display:flex;justify-content:space-between;padding:6px 0;border-bottom:1px solid #eceef2;font-size:10px; }
.invoice-totals .grand-total { border:0;margin-top:5px;padding:10px;background:#efefff;font-size:12px; }
.document-note { margin-top:30px;border-left:3px solid #6260c9;padding-left:10px;font-size:10px; }
.cv-layout { display:grid;grid-template-columns:180px 1fr;min-height:750px; }
.cv-layout aside { margin:-48px 0 -48px -54px;padding:48px 24px;color:white;background:#303758; }
.cv-layout aside h3 { margin:22px 0 6px;font-family:"Manrope",sans-serif;font-size:10px;text-transform:uppercase;letter-spacing:.8px;color:#cbcffa; }
.cv-layout aside p { font-size:9px;line-height:1.7; }
.cv-photo { width:100px;height:120px;display:grid;place-items:center;margin:0 auto 20px;border:2px solid rgba(255,255,255,.5);color:white;background:#626c99;font-size:9px;text-align:center; }
.cv-layout main { padding:30px 0 20px 28px; }
.cv-layout main h1 { color:#303758;font-size:28px; }
.cv-subtitle { color:#6260c9;font-weight:bold;text-transform:uppercase;letter-spacing:1.5px; }
.cv-layout main section { margin-top:20px;border-bottom:1px solid #eceef2;padding-bottom:10px; }
.cv-layout main section h2 { color:#6260c9;font-size:11px;text-transform:uppercase; }
.contract-parties { display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:16px 0; }
.contract-parties div { border:1px solid #e4e6eb;border-radius:5px;padding:12px;font-size:10px; }
.contract-parties span { display:block;margin-top:6px;color:#6f7685; }
.contract-signs { display:flex;justify-content:space-between;margin-top:30px;text-align:center; }
.contract-signs div { width:180px; }
.contract-signs p { font-size:10px; }
.report-info { display:flex;justify-content:space-between;border-bottom:1px solid #dde1e8;padding:8px 0;font-size:9px; }
.document-page-ad { margin-top:25px;border-top:1px solid #eee; }
.document-page-ad .ad-slot { min-height:55px;margin:10px 0 0; }
.print-body { margin:0;background:white; }
.print-body .document-page { box-shadow:none; }
.pkl-cover { min-height:760px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center; }
.pkl-cover h1 { margin:20px 0 10px;color:#263044;font-family:"Manrope",sans-serif;font-size:24px;line-height:1.35;letter-spacing:.5px; }
.pkl-cover p { margin:4px 0;font-size:12px;font-weight:700; }
.cover-logo { width:62px;height:62px;display:grid;place-items:center;border:2px solid #6260c9;border-radius:50%;color:#6260c9;font-size:9px;font-weight:800; }
.cover-photo { width:140px;height:170px;display:grid;place-items:center;margin:28px 0 14px;border:1px solid #dfe3e9;color:#9aa2af;background:#fafbfc;font-size:10px; }
.cover-identity { display:grid;gap:5px;margin:12px 0;font-size:11px; }
.cover-bottom { width:100%;display:grid;gap:8px;margin-top:auto;padding-top:30px; }
.page-break { height:850px;display:grid;place-items:center;border-top:1px dashed #cfd4df;color:#adb4c0;font-size:9px;letter-spacing:1px;break-before:page; }
.page-break span { align-self:start;margin-top:-8px;background:white;padding:0 8px; }
.toc { display:grid;gap:8px;padding-left:24px; }
.activity-table { width:100%;border-collapse:collapse;margin:12px 0; }
.activity-table th { padding:8px;border:1px solid #dfe3e9;background:#f2f3f7;font-size:9px;text-align:left; }
.activity-table td { border:1px solid #dfe3e9;padding:8px;font-size:9px; }
.photo-grid { display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:14px 0; }
.photo-placeholder { min-height:150px;display:grid;place-items:center;border:1px dashed #cfd4df;border-radius:4px;color:#9aa2af;background:#fafbfc;text-align:center;font-size:9px; }
.signature-row { display:flex;justify-content:space-between;margin-top:28px;text-align:center; }
.signature-row div { width:210px;font-size:10px; }
.format-panel { margin:10px 0;border:1px solid #e5e7ef;border-radius:8px;padding:10px;background:white; }
.format-panel label { display:grid;gap:5px;color:#697184;font-size:9px;font-weight:800; }
.format-panel select { height:36px;border:1px solid #dfe3ea;border-radius:6px;padding:0 8px;color:#303746;background:white;font-size:10px; }
.reference-panel { margin:8px 0 12px;border:1px solid #e5e7ef;border-radius:8px;padding:9px;background:#fafbfc;color:#697184;font-size:9px; }
.reference-panel summary { cursor:pointer;font-weight:800;color:#625bd4; }
.reference-panel a { color:#625bd4;text-decoration:none; }
.reference-panel a:hover { text-decoration:underline; }
.reference-panel div { display:grid;gap:6px;margin-top:8px;line-height:1.45; }
.modal-backback { position:fixed;z-index:80;inset:0;display:grid;place-items:center;padding:16px;background:rgba(22,27,43,.48);backdrop-filter:blur(4px); }
.modal-backback[hidden] { display:none; }
.download-ad-modal { position:relative;width:min(520px,calc(100vw - 32px));border-radius:14px;padding:24px;background:white;box-shadow:0 24px 70px rgba(20,25,38,.28);text-align:center; }
.download-ad-modal .modal-close { right:12px;top:10px;position:absolute; }
.ad-modal-kicker { margin:0 0 6px;color:#6760d2;font-size:9px;font-weight:800;letter-spacing:1px; }
.download-ad-modal h2 { font-size:20px; }
.download-ad-modal > p:not(.ad-modal-kicker) { margin:8px 0 14px;color:var(--muted);font-size:11px; }
.download-ad-frame { position:relative;min-height:150px;display:grid;place-items:center;border:1px dashed #dfe3ea;border-radius:9px;background:#fafbfc;overflow:hidden; }
.download-ad-frame > .ad-label { position:absolute;right:8px;top:7px;z-index:2; }
.ad-download-slot { display:block!important;width:100%;min-height:120px; }
.ad-download-slot:empty { display:none!important; }
#downloadAdPlaceholder { display:grid;place-items:center;gap:4px;color:#9da4b0;font-size:11px; }
#downloadAdPlaceholder small { font-size:9px;color:#b2b7c1; }
.download-ad-frame.loaded #downloadAdPlaceholder { display:none; }
.ad-status-row { height:38px;display:flex;align-items:center;justify-content:center;gap:7px;color:#747d8d;font-size:10px; }
.ad-status-dot { width:7px;height:7px;border-radius:50%;background:#d99b48;box-shadow:0 0 0 4px #fff2df; }
.ad-status-dot.loading { animation:adPulse 1.2s infinite; }
.ad-status-dot.ready { background:#50a779;box-shadow:0 0 0 4px #edf8f2; }
.ad-status-dot.error { background:#dc7777;box-shadow:0 0 0 4px #fff0f0; }
@keyframes adPulse { 50% { opacity:.35; } }
.download-ad-actions { display:flex;justify-content:flex-end;gap:8px;border-top:1px solid var(--line);padding-top:12px; }
.download-ad-actions .secondary-button { margin-right:auto; }
.download-ad-actions .download-button:disabled { cursor:not-allowed;opacity:.45;box-shadow:none; }
.preview-panel { position:relative; }
.preview-panel { grid-template-rows:58px minmax(0,1fr) 58px 42px 64px!important; }
.preview-toolbar { height:58px!important;overflow:hidden; }
.editor-tools,.editor-tools-secondary { display:flex;align-items:center;gap:3px; }
.editor-tools button,.editor-tools-secondary button { height:34px;min-width:34px;border:0;border-radius:6px;padding:0 7px;color:#697184;background:transparent;font-size:11px; }
.editor-tools button:hover,.editor-tools-secondary button:hover { background:#f0f1f6;color:#625bd4; }
.editor-tools span { width:1px;height:22px;margin:0 4px;background:#e5e7ec; }
#autoCompose { color:#625bd4;background:#efefff;font-weight:800; }
.document-scroll { background:#eef0f5!important; }
.page-stack { display:grid;gap:18px; }
.document-page { outline:none;position:relative; }
.document-page[contenteditable="true"]:focus { box-shadow:0 8px 28px rgba(38,44,60,.16),0 0 0 2px #deddf8; }
.document-page.page-f4 { width:min(640px,100%); }
.document-page.margin-narrow { padding:28px 34px!important; }
.document-page.margin-wide { padding:58px 68px!important; }
.document-page.with-header::before { content:attr(data-header);display:block;margin:-25px 0 24px;border-bottom:1px solid #dfe3e9;padding-bottom:8px;color:#778195;font-size:9px;text-align:right; }
.document-page.with-footer::after { content:"Halaman " attr(data-page);display:block;margin:32px 0 -24px;padding-top:8px;border-top:1px solid #dfe3e9;color:#778195;font-size:9px;text-align:right; }
.mobile-page-actions { width:min(680px,100%);display:flex;justify-content:flex-end;gap:5px;margin:0 auto 8px; }
.mobile-page-actions button,.mobile-extra-tools button { height:32px;border:1px solid #e1e4eb;border-radius:6px;padding:0 8px;color:#697184;background:white;font-size:9px;font-weight:700; }
.editor-popover { position:absolute;z-index:15;right:18px;top:52px;display:flex;gap:8px;border:1px solid #e1e4eb;border-radius:8px;padding:10px;background:white;box-shadow:0 12px 30px rgba(38,44,60,.12); }
.editor-popover[hidden] { display:none; }
.editor-popover label { display:grid;gap:4px;color:#697184;font-size:9px; }
.editor-popover select,.editor-popover input { height:34px;border:1px solid #dfe3ea;border-radius:6px;padding:0 8px;font-size:10px; }
.toggle-row { grid-auto-flow:column;align-items:center; }
.toggle-row input { width:14px;height:14px; }
.find-popover { left:18px;right:auto; }
.ai-popover { width:min(360px,calc(100% - 36px));display:grid; }
.ai-actions { display:grid;grid-template-columns:repeat(2,1fr);gap:5px; }
.ai-actions button { height:32px;border:1px solid #e4e6ed;border-radius:6px;color:#6260c9;background:#f8f8ff;font-size:9px;font-weight:700; }
.mobile-extra-tools { height:42px;display:flex;align-items:center;gap:6px;padding:0 18px;border-top:1px solid var(--line);background:white; }
.admin-entry { width:100%;height:38px;margin-top:12px;border:1px solid #e3e5ed;border-radius:8px;color:#6260c9;background:white;font-size:10px;font-weight:800; }
.admin-entry:hover { border-color:#cfcfeb;background:#f8f8ff; }
.admin-shell { min-height:calc(100vh - 140px); }
.admin-top { display:flex;align-items:center;justify-content:space-between;margin-bottom:18px; }
.admin-top h1 { font-size:25px; }
.admin-top p { margin:4px 0 0;color:var(--muted);font-size:11px; }
.admin-actions { display:flex;gap:8px; }
.admin-actions button { height:38px;border:1px solid var(--line);border-radius:8px;padding:0 12px;color:#697184;background:white;font-size:10px;font-weight:800; }
.admin-actions button.primary { border-color:#6260c9;color:white;background:#6260c9; }
.admin-tabs { display:flex;gap:5px;margin-bottom:14px;border-bottom:1px solid var(--line); }
.admin-tab { height:40px;border:0;border-bottom:2px solid transparent;padding:0 10px;color:#7b8393;background:transparent;font-size:11px;font-weight:800; }
.admin-tab.active { border-bottom-color:#6260c9;color:#6260c9; }
.admin-metrics { display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:14px; }
.admin-card { min-height:112px;border:1px solid var(--line);border-radius:10px;padding:16px;background:white; }
.admin-card p { margin:0;color:var(--muted);font-size:10px; }
.admin-card strong { display:block;margin:8px 0 4px;font-family:"Manrope",sans-serif;font-size:24px; }
.admin-card small { color:#58a37a;font-size:9px;font-weight:800; }
.admin-grid { display:grid;grid-template-columns:minmax(0,1.7fr) minmax(260px,.8fr);gap:12px; }
.admin-panel { border:1px solid var(--line);border-radius:10px;padding:16px;background:white; }
.admin-panel h3 { margin:0 0 12px;font-size:12px; }
.chart-area { height:230px;display:flex;align-items:flex-end;gap:8px;border-bottom:1px solid #e8eaf0;padding:12px 5px 0;background:linear-gradient(to bottom,transparent 24%,#f4f5f8 25%,transparent 26%,transparent 49%,#f4f5f8 50%,transparent 51%,transparent 74%,#f4f5f8 75%,transparent 76%); }
.chart-bar { flex:1;border-radius:5px 5px 0 0;background:linear-gradient(180deg,#7771df,#a8a5eb); }
.chart-bar.alt { background:linear-gradient(180deg,#58b18a,#a9dcc7); }
.chart-labels { display:flex;justify-content:space-between;margin-top:7px;color:#9aa1ae;font-size:8px; }
.rank-list { display:grid;gap:10px; }
.rank-row { display:grid;grid-template-columns:24px 1fr auto;align-items:center;gap:8px;font-size:10px; }
.rank-row b { width:24px;height:24px;display:grid;place-items:center;border-radius:6px;color:#6260c9;background:#efefff;font-size:9px; }
.rank-row span { min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.rank-row strong { font-size:10px; }
.admin-table { width:100%;border-collapse:collapse; }
.admin-table th { height:38px;color:#9299a7;border-bottom:1px solid var(--line);font-size9px;text-align:left; }
.admin-table td { height:48px;border-bottom:1px solid #f0f1f4;color:#697184;font-size10px; }
.status-badge { display:inline-flex;height:22px;align-items:center;border-radius:99px;padding:0 8px;color:#4b9672;background:#eaf7ef;font-size:8px;font-weight:800; }
.status-badge.warning { color:#b27d3c;background:#fff3df; }
.marketing-grid { display:grid;grid-template-columns:1fr 1fr;gap:12px; }
.field-grid { display:grid;grid-template-columns:repeat(2,1fr);gap10px; }
.admin-field { display:grid;gap5px;color:#697184;font-size9px;font-weight800; }
.admin-field input,.admin-field select { height:38px;border:1px solid #e1e4ea;border-radius:7px;padding:0 9px;font-size:10px; }
.ad-slot.adsense-demo,.ad-slot.adsense-failed { min-height:72px; }
.ad-slot .adsense-responsive-slot { max-width:100%; }
.ad-slot .ad-fallback { display:none; }
.ad-slot.adsense-demo .adsense-responsive-slot,.ad-slot.adsense-failed .adsense-responsive-slot { display:none!important; }
.ad-slot.adsense-demo .ad-fallback,.ad-slot.adsense-failed .ad-fallback { display:inline; }
.cookie-banner { position:fixed;z-index:70;left:260px;right:18px;bottom:18px;display:flex;align-items:center;justify-content:space-between;gap:18px;border:1px solid #e2e5ec;border-radius12px;padding14px 16px;background:white;box-shadow:0 12px 38px rgba(38,44,60,.14); }
.cookie-banner[hidden] { display:none; }
.cookie-banner strong { font-size11px; }
.cookie-banner p { max-width760px;margin3px 0 0;color:#7d8494;font-size9px;line-height1.5; }
.cookie-banner a { color:#625bd4;font-weight800;text-decoration:none; }
.cookie-actions { display:flex;gap7px; }
.cookie-actions button { height34px;border:1px solid #e1e4ea;border-radius7px;padding0 10px;color:#697184;background:white;font-size9px;font-weight800; }
.cookie-actions button.primary { border-color:#625bd4;color:white;background:#625bd4; }

@media (max-width:1050px) {
  .category-grid { grid-template-columns:repeat(3,1fr); }
  .template-grid { grid-template-columns:repeat(3,1fr); }
  .workspace-grid { grid-template-columns:320px 1fr; }
  .admin-metrics { grid-template-columns:repeat(2,1fr); }
}
@media (max-width:760px) {
  .free-label { display:none; }
  .hero { min-height:190px;padding:28px 24px; }
  .hero h1 { font-size:29px; }
  .hero-stat { display:none; }
  .category-grid { grid-template-columns:repeat(2,1fr); }
  .template-grid { grid-template-columns:repeat(2,1fr); }
  .workspace-grid { grid-template-columns:1fr;overflow-y:auto; }
  .form-panel { max-height:42%;border-right:0;border-bottom:1px solid var(--line); }
  .preview-panel { min-height:520px;grid-template-rows:44px minmax(420px,1fr) 58px 64px; }
  .template-workspace { height:calc(100vh - 16px);width:calc(100vw - 16px); }
  .document-scroll { padding:10px; }
  .document-page { padding:32px 28px;min-height:700px; }
  .cv-layout { grid-template-columns:140px 1fr; }
  .cv-layout aside { margin:-32px 0 -32px -28px;padding:32px 18px; }
  .admin-top { align-items:flex-start;gap:12px; }
  .admin-actions { flex-direction:column; }
  .admin-metrics { grid-template-columns:1fr 1fr; }
  .admin-grid,.marketing-grid { grid-template-columns:1fr; }
  .admin-tabs { overflow-x:auto; }
  .admin-tab { white-space:nowrap; }
  .cookie-banner { left:10px;right:10px;bottom:10px;align-items:flex-start; }
}
@media (max-width:520px) {
  .hero h1 { font-size:24px; }
  .hero p { font-size:11px; }
  .category-grid,.template-grid { grid-template-columns:1fr; }
  .category-banner { padding:22px; }
  .category-total { display:none; }
  .workspace-header { height:64px; }
  .workspace-grid { height:calc(100% - 64px); }
  .download-bar { flex-wrap:wrap;height:auto; }
  .download-bar button { flex:1;white-space:nowrap;padding:0 8px; }
  .document-page { font-size:11px; }
  .identity-grid { grid-template-columns:1fr; }
  .cv-layout { grid-template-columns:110px 1fr; }
  .cv-layout main { padding-left:18px; }
  .admin-top { display:grid; }
  .admin-actions { display:grid;grid-template-columns:1fr 1fr; }
  .admin-metrics { grid-template-columns:1fr; }
  .field-grid { grid-template-columns:1fr; }
  .admin-table th:nth-child(3),.admin-table td:nth-child(3) { display:none; }
}

/* LAPORIN modern interface overrides */
:root {
  --navy: #111827;
  --text: #172033;
  --muted: #718096;
  --line: #e7eaf1;
  --page: #f5f7fb;
  --primary: #5b57d9;
  --primary-soft: #efefff;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 18;
  backdrop-filter: blur(14px);
  background: rgba(255,255,255,.92);
}

.search {
  height: 46px;
  border-radius: 11px;
  background: #f8f9fc;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.search:focus-within {
  border-color: #aaa7ed;
  background: white;
  box-shadow: 0 0 0 4px rgba(91,87,217,.08);
}

.hero {
  position: relative;
  min-height: 245px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  background:
    radial-gradient(circle at 85% 20%, rgba(255,255,255,.14), transparent 24%),
    linear-gradient(125deg,#111827 0%,#292d66 58%,#5b57d9 100%);
  box-shadow: 0 18px 40px rgba(32,38,74,.12);
}
.hero h1 { font-size: clamp(30px,4vw,42px); max-width: 620px; }
.hero p { max-width: 590px; }

.category-card,
.template-card,
.stat-card,
.table-wrap {
  box-shadow: 0 4px 16px rgba(31,42,68,.035);
}
.category-card {
  min-height: 118px;
  border-radius: 14px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.category-card:hover,
.template-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(31,42,68,.09);
}
.template-card {
  min-height: 158px;
  grid-template-columns: 64px 1fr;
  border-radius: 14px;
  padding: 16px;
}
.template-preview-icon {
  width: 64px;
  height: 82px;
  border-radius: 7px;
  background: linear-gradient(150deg,#fff 68%,#ececff 68%);
}
.template-card-copy strong { font-size: 14px; }
.template-card-arrow { font-size: 11px; }
.template-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
.category-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }

.section-heading h2 { font-size: 18px; }
.template-heading { margin-top: 32px; }

.workspace-header {
  background: white;
}
.form-panel { background: #fbfcfe; }
.preview-panel { background: #edf0f5; }
.preview-toolbar {
  height: 44px;
  position: relative;
  z-index: 3;
}
.document-scroll { padding: 24px; }
.document-page {
  border-radius: 3px;
  box-shadow: 0 12px 34px rgba(31,42,68,.14);
}
.download-bar {
  min-height: 64px;
  gap: 10px;
}
.download-button,
.secondary-button {
  min-height: 42px;
  border-radius: 9px;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.download-button:not(:disabled):hover,
.secondary-button:hover { transform: translateY(-1px); }
.download-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: .65;
}
.download-button.is-loading::before,
.secondary-button.is-loading::before,
.auto-loading::before {
  content: "";
  width: 13px;
  height: 13px;
  display: inline-block;
  margin-right: 7px;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: laporin-spin .7s linear infinite;
}
@keyframes laporin-spin { to { transform: rotate(360deg); } }

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  max-width: min(360px,calc(100vw - 32px));
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 11px;
  padding: 12px 16px;
  background: #172033;
}
.toast.success { background: #16794a; }
.toast.error { background: #b83a45; }
.toast::before {
  content: "✓";
  width: 22px;
  height: 22px;
  display: grid;
  flex: 0 0 22px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,.16);
  font-size: 11px;
  font-weight: 900;
}
.toast.error::before { content: "!"; }

@media (max-width:1050px) {
  .category-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .template-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width:760px) {
  .topbar { height: 68px; }
  .hero { min-height: 220px; padding: 26px 22px; }
  .hero h1 { font-size: 28px; }
  .category-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .template-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .template-card { min-height: 150px; grid-template-columns: 54px 1fr; }
  .template-preview-icon { width: 54px; height: 72px; }
  .workspace-grid { display: block; overflow-y: auto; }
  .form-panel { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .preview-panel { min-height: 610px; grid-template-rows: 44px minmax(430px,1fr) 58px 64px; }
  .preview-toolbar { padding: 0 8px; }
  .editor-tools-secondary { gap: 4px; }
  #savedStatus { display: none; }
  .document-scroll { padding: 12px 8px; }
  .document-page { width: calc(100% - 4px); min-height: 620px; padding: 28px 22px; }
  .download-bar { position: sticky; bottom: 0; z-index: 5; }
  .mobile-extra-tools { overflow-x: auto; min-height: 48px; }
  .mobile-extra-tools button { min-width: max-content; height: 34px; border: 1px solid var(--line); border-radius: 7px; background: white; }
  .toast { right: 16px; bottom: 16px; }
}
@media (max-width:520px) {
  .content { padding-top: 18px; }
  .search kbd { display: none; }
  .top-actions .free-label { display: none; }
  .hero { min-height: 205px; border-radius: 14px; }
  .hero h1 { font-size: 23px; }
  .hero p { margin-top: 10px; line-height: 1.55; }
  .category-grid,
  .template-grid { grid-template-columns: 1fr; }
  .template-card { min-height: 118px; grid-template-columns: 58px 1fr; }
  .template-preview-icon { width: 58px; height: 78px; }
  .template-card-arrow { padding-top: 7px; }
  .category-card { min-height: 96px; }
  .template-workspace { border-radius: 10px; }
  .workspace-header { height: 60px; }
  .workspace-grid { height: calc(100% - 60px); }
  .workspace-header h2 { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .download-bar { display: grid; grid-template-columns: 1fr 1fr; padding: 8px; }
  #generateButton { grid-column: 1/-1; }
  .download-bar button { width: 100%; min-width: 0; }
  .document-page { padding: 24px 16px; }
  .editor-tools button { min-width: 27px; }
  .editor-tools-secondary button { height: 34px; padding: 0 8px; }
  .form-panel { padding: 14px 14px 20px; }
}
