/* HumanWriter */

:root {
    --bg: #0e1116;
    --bg2: #151a21;
    --bg3: #1c232c;
    --line: #262e39;
    --tx: #e6eaf0;
    --tx2: #9aa6b6;
    --tx3: #6b7686;
    --ac: #4f8cff;
    --ac2: #3a6fd8;
    --ok: #35c184;
    --warn: #e0a83c;
    --err: #e5484d;
    --r: 10px;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--tx);
    font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--ac); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- layout ---------- */

.shell { display: flex; min-height: 100vh; }

.side {
    width: 232px;
    flex: 0 0 232px;
    background: var(--bg2);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.3px;
    padding: 0 20px 22px;
}
.brand span { color: var(--ac); }

.side nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }

.side nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--tx2);
    font-size: 14.5px;
    text-decoration: none;
    transition: background .12s, color .12s;
}
.side nav a:hover { background: var(--bg3); color: var(--tx); }
.side nav a.on { background: var(--ac); color: #fff; font-weight: 500; }

.side nav i {
    width: 16px; height: 16px;
    flex: 0 0 16px;
    background: currentColor;
    opacity: .85;
    -webkit-mask-size: contain; mask-size: contain;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: center; mask-position: center;
}
i[data-ic="home"]  { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M12 3 2 12h3v9h6v-6h2v6h6v-9h3z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M12 3 2 12h3v9h6v-6h2v6h6v-9h3z'/></svg>"); }
i[data-ic="pen"]   { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M3 17.25V21h3.75L17.8 9.94l-3.75-3.75zM20.7 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M3 17.25V21h3.75L17.8 9.94l-3.75-3.75zM20.7 7.04a1 1 0 0 0 0-1.41l-2.34-2.34a1 1 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z'/></svg>"); }
i[data-ic="wand"]  { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='m7.5 5.6 1.4-3.1 1.4 3.1 3.1 1.4-3.1 1.4-1.4 3.1-1.4-3.1L4.4 7zM19 13l.9-2 .9 2 2 .9-2 .9-.9 2-.9-2-2-.9zM3 20.6 14.6 9l1.4 1.4L4.4 22z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='m7.5 5.6 1.4-3.1 1.4 3.1 3.1 1.4-3.1 1.4-1.4 3.1-1.4-3.1L4.4 7zM19 13l.9-2 .9 2 2 .9-2 .9-.9 2-.9-2-2-.9zM3 20.6 14.6 9l1.4 1.4L4.4 22z'/></svg>"); }
i[data-ic="globe"] { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20m0 2c1.3 0 2.7 2 3.2 5H8.8C9.3 6 10.7 4 12 4M4.3 11h3.4c-.1 1.3-.1 2.7 0 4H4.3a8 8 0 0 1 0-4m0 6h3.6c.4 1.8 1 3.3 1.7 4.3A8 8 0 0 1 4.3 17m5.7 0h4c-.5 3-1.9 5-3 5s-2.5-2-3-5zm-.2-2a29 29 0 0 1 0-4h4.4a29 29 0 0 1 0 4zm6.4 6.3c.7-1 1.3-2.5 1.7-4.3h3.6a8 8 0 0 1-5.3 4.3M19.7 15h-3.4c.1-1.3.1-2.7 0-4h3.4a8 8 0 0 1 0 4m-3.8-6c-.4-1.8-1-3.3-1.7-4.3A8 8 0 0 1 19.7 9z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20m0 2c1.3 0 2.7 2 3.2 5H8.8C9.3 6 10.7 4 12 4M4.3 11h3.4c-.1 1.3-.1 2.7 0 4H4.3a8 8 0 0 1 0-4m0 6h3.6c.4 1.8 1 3.3 1.7 4.3A8 8 0 0 1 4.3 17m5.7 0h4c-.5 3-1.9 5-3 5s-2.5-2-3-5zm-.2-2a29 29 0 0 1 0-4h4.4a29 29 0 0 1 0 4zm6.4 6.3c.7-1 1.3-2.5 1.7-4.3h3.6a8 8 0 0 1-5.3 4.3M19.7 15h-3.4c.1-1.3.1-2.7 0-4h3.4a8 8 0 0 1 0 4m-3.8-6c-.4-1.8-1-3.3-1.7-4.3A8 8 0 0 1 19.7 9z'/></svg>"); }
i[data-ic="clock"] { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20m1 10.4V6h-2v7.6l5 3 1-1.7z'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20m1 10.4V6h-2v7.6l5 3 1-1.7z'/></svg>"); }
i[data-ic="gear"]  { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8m9 4c0-.6 0-1.2-.1-1.7l2.1-1.6-2-3.4-2.5 1a8 8 0 0 0-3-1.7L15 2H9l-.5 2.6a8 8 0 0 0-3 1.7l-2.4-1-2 3.4 2 1.6a9 9 0 0 0 0 3.4l-2 1.6 2 3.4 2.4-1a8 8 0 0 0 3 1.7L9 22h6l.5-2.6a8 8 0 0 0 3-1.7l2.5 1 2-3.4-2.1-1.6c.1-.5.1-1.1.1-1.7'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'><path d='M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8m9 4c0-.6 0-1.2-.1-1.7l2.1-1.6-2-3.4-2.5 1a8 8 0 0 0-3-1.7L15 2H9l-.5 2.6a8 8 0 0 0-3 1.7l-2.4-1-2 3.4 2 1.6a9 9 0 0 0 0 3.4l-2 1.6 2 3.4 2.4-1a8 8 0 0 0 3 1.7L9 22h6l.5-2.6a8 8 0 0 0 3-1.7l2.5 1 2-3.4-2.1-1.6c.1-.5.1-1.1.1-1.7'/></svg>"); }

.side-foot {
    margin-top: auto;
    padding: 16px 20px 0;
    border-top: 1px solid var(--line);
    font-size: 13px;
}
.who { color: var(--tx2); margin-bottom: 4px; }
.lo { color: var(--tx3); font-size: 13px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 28px;
    border-bottom: 1px solid var(--line);
    background: var(--bg2);
}
.top h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.2px; }

.prov {
    font-size: 12px;
    color: var(--tx3);
    font-family: var(--mono);
    background: var(--bg3);
    border: 1px solid var(--line);
    padding: 4px 10px;
    border-radius: 20px;
}

.content { padding: 24px 28px 60px; max-width: 1320px; width: 100%; }

/* ---------- grid ---------- */

.split { display: grid; grid-template-columns: 400px 1fr; gap: 22px; align-items: start; }
@media (max-width: 1080px) { .split { grid-template-columns: 1fr; } }

.card {
    background: var(--bg2);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 20px;
}
.card h2 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.card h2.sub { color: var(--tx2); font-weight: 500; }

/* ---------- forms ---------- */

label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--tx2); font-weight: 500; }

input[type=text], input[type=password], input[type=number], input[type=url], select, textarea {
    width: 100%;
    margin-top: 6px;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--tx);
    padding: 9px 11px;
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color .12s;
}
input:focus, select:focus, textarea:focus { border-color: var(--ac); }
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
select { cursor: pointer; }

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--ac);
    color: #fff;
    border: 0;
    padding: 10px 18px;
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s;
}
.btn:hover { background: var(--ac2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.wide { width: 100%; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--tx2); font-weight: 500; }
.btn.ghost:hover { background: var(--bg3); color: var(--tx); }
.btn.sm { padding: 6px 12px; font-size: 13px; }

.hint { font-size: 12px; color: var(--tx3); margin: -8px 0 14px; line-height: 1.5; }

/* ---------- output ---------- */

.out-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.out-tools { display: flex; gap: 8px; }

.output {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px 26px;
    min-height: 380px;
    font-size: 15.5px;
    line-height: 1.75;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.output.rendered { white-space: normal; }
.output.rendered h1 { font-size: 24px; margin: 0 0 16px; line-height: 1.3; }
.output.rendered h2 { font-size: 19px; margin: 28px 0 10px; line-height: 1.35; }
.output.rendered h3 { font-size: 16px; margin: 22px 0 8px; }
.output.rendered p { margin: 0 0 15px; }
.output.rendered ul, .output.rendered ol { margin: 0 0 15px; padding-left: 22px; }
.output.rendered li { margin-bottom: 6px; }
.output.rendered code { background: var(--bg3); padding: 2px 5px; border-radius: 4px; font-family: var(--mono); font-size: .9em; }
.output.rendered a { color: var(--ac); }
.output .ph { color: var(--tx3); font-style: italic; }

.stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--tx3);
    font-family: var(--mono);
    margin-top: 12px;
}

/* ---------- progress log ---------- */

.log {
    background: #090c10;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px 16px;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.75;
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 16px;
    display: none;
}
.log.on { display: block; }
.log div { color: var(--tx2); }
.log div.step { color: var(--ac); font-weight: 600; margin-top: 6px; }
.log div.good { color: var(--ok); }
.log div.bad { color: var(--err); }
.log div.dim { color: var(--tx3); }

/* ---------- sources ---------- */

.src { margin-top: 18px; }
.src h3 { font-size: 13px; color: var(--tx2); margin: 0 0 8px; }
.src ol { margin: 0; padding-left: 20px; font-size: 13px; color: var(--tx2); }
.src li { margin-bottom: 5px; }
.src a { color: var(--ac); }

/* ---------- alerts ---------- */

.alert { padding: 11px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; }
.alert.err { background: rgba(229, 72, 77, .12); border: 1px solid rgba(229, 72, 77, .35); color: #ff9b9e; }
.alert.ok { background: rgba(53, 193, 132, .12); border: 1px solid rgba(53, 193, 132, .35); color: #7ee2b4; }
.alert.warn { background: rgba(224, 168, 60, .12); border: 1px solid rgba(224, 168, 60, .35); color: #f0cd8a; }

/* ---------- tables ---------- */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { color: var(--tx3); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tr:hover td { background: var(--bg3); }

.tag {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--bg3);
    color: var(--tx2);
    font-weight: 500;
}
.tag.write { background: rgba(79, 140, 255, .15); color: #8fb6ff; }
.tag.humanize { background: rgba(53, 193, 132, .15); color: #7ee2b4; }
.tag.article { background: rgba(224, 168, 60, .15); color: #f0cd8a; }

/* ---------- dashboard ---------- */

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 26px; }
.tile {
    background: var(--bg2);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 20px;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: border-color .12s, transform .12s;
}
.tile:hover { border-color: var(--ac); text-decoration: none; transform: translateY(-2px); }
.tile h3 { margin: 0 0 6px; font-size: 15px; }
.tile p { margin: 0; font-size: 13.5px; color: var(--tx2); line-height: 1.55; }
.tile .big { font-size: 28px; font-weight: 700; margin-bottom: 2px; }

.muted { color: var(--tx3); font-size: 13px; }

/* ---------- auth ---------- */

.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card {
    background: var(--bg2);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 32px;
    width: 100%;
    max-width: 380px;
}
.auth-card h1 { margin: 0 0 18px; font-size: 20px; }
.auth-card .btn { width: 100%; margin-top: 4px; }

/* ---------- spinner ---------- */

.spin {
    width: 14px; height: 14px;
    border: 2px solid rgba(255, 255, 255, .3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: sp .7s linear infinite;
    display: inline-block;
}
@keyframes sp { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
    .shell { flex-direction: column; }
    .side { width: 100%; flex: none; height: auto; position: static; padding: 14px 0; }
    .side nav { flex-direction: row; overflow-x: auto; }
    .side nav a { white-space: nowrap; }
    .side-foot { display: flex; gap: 12px; align-items: center; padding-top: 12px; }
    .content { padding: 16px; }
    .top { padding: 14px 16px; }
    .row2 { grid-template-columns: 1fr; }
}
