@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600&display=swap');
:root { --bg: #efeff2; --card: #fff; --ink: #141414; --sub: #6b6b72; --line: #e2e2e8; --acc: #6d4aff; --acc-soft: #efeaff; --danger: #c0392b; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 'Outfit', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

.btn { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 8px 16px; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: #c9c9d2; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #333; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(0, 0, 0, .05); }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn.danger { color: var(--danger); }
.seg { display: inline-flex; background: #e6e6ec; border-radius: 99px; padding: 3px; }
.seg button { border: 0; background: transparent; border-radius: 99px; padding: 5px 13px; font-size: 13px; font-weight: 500; color: var(--sub); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--sub); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--acc); outline-offset: -1px; border-color: transparent; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.hint { font-size: 13px; color: var(--sub); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; border-radius: 99px; padding: 10px 10px 10px 18px; display: flex; gap: 12px; align-items: center; transition: .25s ease; z-index: 100; font-size: 14px; }
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { background: rgba(255, 255, 255, .16); border: 0; color: #fff; border-radius: 99px; padding: 5px 12px; font-weight: 500; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(20, 20, 24, .45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 50; overflow: auto; }
.modal > .sheet { background: var(--bg); border-radius: 20px; width: min(1180px, 100%); padding: 24px clamp(16px, 3vw, 32px) 32px; box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.modal > .sheet.narrow { width: min(480px, 100%); background: #fff; margin-top: 10vh; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.sheet-head h2 { margin: 0; font-size: 22px; font-weight: 600; }

/* Template picker */
.kinds { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.tcard { background: var(--card); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); display: flex; flex-direction: column; text-align: left; padding: 0; transition: transform .15s ease, box-shadow .15s ease; }
.tcard:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0, 0, 0, .1); }
.tcard.current { outline: 2px solid var(--acc); }
.tthumb { aspect-ratio: 4 / 3; background: linear-gradient(150deg, #d9d3c7, #b9b0a1) center / cover; display: flex; align-items: center; justify-content: center; font-size: 28px; color: rgba(255, 255, 255, .9); font-weight: 600; }
.tmeta { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 2px; }
.tmeta b { font-weight: 600; font-size: 16px; }
.tmeta small { color: var(--sub); }
.tmeta .tlinks { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 13px; }
.tmeta .tlinks a { color: var(--sub); text-decoration: none; }
.tmeta .tlinks a:hover { color: var(--ink); text-decoration: underline; }
