@font-face { font-family: "Poppins"; src: url("/brand/Poppins-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("/brand/Poppins-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --purple: #5B2DAB; --lavender: #8E6BEE; --black: #0B0B0F; --white: #FFFFFF;
  --ink: #0B0B0F; --muted: #5d5a6b; --line: #e4e0ee; --wash: #f6f3fc; --bad: #a3212b;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: "Poppins", system-ui, sans-serif; font-weight: 500; color: var(--ink); background: var(--wash); font-size: 15px; line-height: 1.5; }
h1, h2, strong, th { font-weight: 700; }
h1 { font-size: 28px; margin: 18px 0 6px; }
h2 { font-size: 20px; margin: 0 0 14px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 36px; }
.signin { width: min(420px, 100%); text-align: center; }
.signin .logo { width: 190px; height: auto; }
.signin p { margin: 0 0 22px; }
.msg { color: var(--bad); margin-top: 14px; }

.btn { font: inherit; font-weight: 500; border: 1px solid var(--line); background: var(--white); color: var(--ink); border-radius: 8px; padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap; }
.btn:hover { border-color: var(--lavender); }
.btn:focus-visible, .crumb:focus-visible, .name:focus-visible, .preset:focus-visible, input:focus-visible { outline: 3px solid var(--lavender); outline-offset: 2px; }
.btn.primary { background: var(--purple); border-color: var(--purple); color: var(--white); }
.btn.primary:hover { background: #4b2491; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--wash); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; padding: 12px 16px; }

.top { background: var(--black); color: var(--white); display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; }
.top .brand { display: flex; align-items: center; gap: 12px; color: var(--white); text-decoration: none; font-weight: 700; font-size: 17px; }
.top .brand img { width: 30px; height: 30px; }
.top-right { display: flex; align-items: center; gap: 12px; }
.top .muted { color: #c9c3da; }
.top .btn.ghost { color: var(--white); }
.top .btn.ghost:hover { background: #24222c; }

.page { max-width: 1120px; margin: 0 auto; padding: 28px 24px 60px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 18px; }
.crumb { font: inherit; font-weight: 700; background: none; border: 0; padding: 2px 4px; color: var(--ink); cursor: pointer; border-radius: 6px; }
.crumb:hover { color: var(--purple); }
.sep { color: var(--muted); }

.drop { position: relative; background: var(--white); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; min-height: 220px; }
.drop-hint { display: none; position: absolute; inset: 0; background: rgba(91, 45, 171, .92); color: var(--white); font-weight: 700; font-size: 20px; place-items: center; }
.drop.over .drop-hint { display: grid; }
.files { width: 100%; border-collapse: collapse; }
.files th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); }
.files td { padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.files tr:last-child td { border-bottom: 0; }
.files tbody tr:hover { background: var(--wash); }
.name { font: inherit; font-weight: 700; color: var(--ink); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; text-align: left; border-radius: 4px; }
.name.plain { cursor: default; }
a.name:hover, button.name:hover { color: var(--purple); }
.ico { width: 18px; height: 18px; flex: none; border-radius: 4px; }
.ico.folder { background: var(--lavender); border-radius: 3px 6px 4px 4px; }
.ico.file { background: var(--white); border: 2px solid var(--purple); border-radius: 3px; height: 20px; width: 16px; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .btn { margin-left: 4px; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); margin: 0; }
.status { min-height: 22px; margin: 14px 4px 0; color: var(--muted); }
.status.bad { color: var(--bad); }

dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(620px, calc(100% - 32px)); color: var(--ink); }
dialog::backdrop { background: rgba(11, 11, 15, .55); }
.dlg { padding: 28px; display: grid; gap: 14px; }
.dlg label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.dlg input { font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; width: 100%; }
.dlg .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.preset { font: inherit; text-align: left; background: var(--wash); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; display: grid; gap: 2px; }
.preset:hover { border-color: var(--lavender); }
.preset span { font-size: 12px; color: var(--muted); }
.ver-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 320px; overflow: auto; }
.ver-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

@media (max-width: 760px) {
  .hide-sm { display: none; }
  .row-actions .btn.ghost { display: none; }
  .page { padding: 20px 14px 48px; }
}

/* New design: template library */
dialog.wide { width: min(980px, calc(100% - 32px)); }
.new-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.new-head h2 { margin: 0; }
.new-head input { max-width: 340px; }
.new-body { display: grid; grid-template-columns: 200px 1fr; gap: 16px; height: min(46vh, 420px); }
.tpl-cats { display: grid; gap: 4px; align-content: start; overflow: auto; }
.cat { font: inherit; text-align: left; background: none; border: 0; border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--ink); }
.cat:hover { background: var(--wash); }
.cat.on { background: var(--purple); color: var(--white); font-weight: 700; }
.cat:focus-visible, select:focus-visible { outline: 3px solid var(--lavender); outline-offset: 2px; }
.new-body .presets { overflow: auto; align-content: start; padding: 2px; }
.preset.on { border-color: var(--purple); background: var(--white); box-shadow: inset 0 0 0 1px var(--purple); }
.new-foot { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.new-foot label { width: 110px; }
.new-foot label.grow { flex: 1; min-width: 200px; width: auto; }
.dlg select { font: inherit; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; width: 100%; background: var(--white); }
#new-note { min-height: 20px; margin: 0; }
@media (max-width: 760px) { .new-body { grid-template-columns: 1fr; height: auto; } .tpl-cats { display: flex; flex-wrap: wrap; } .new-body .presets { max-height: 40vh; } }
