@font-face { font-family: "Be Vietnam Pro"; font-weight: 400; src: url(../assets/fonts/BeVietnamPro-Regular.ttf); font-display: swap; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 500; src: url(../assets/fonts/BeVietnamPro-Medium.ttf); font-display: swap; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 700; src: url(../assets/fonts/BeVietnamPro-Bold.ttf); font-display: swap; }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 900; src: url(../assets/fonts/BeVietnamPro-Black.ttf); font-display: swap; }

:root { --or: #FF6A2B; --or-d: #e4561a; --bg: #F6F2EC; --card: #fff; --ink: #1b1712; --mute: #6f665b; --line: #e8e0d4; --soft: #fbf7f1; --ok: #1f8f4e; --bad: #c8281f; --side: #14100c; color-scheme: light; }
@media (prefers-color-scheme: dark) { :root { --bg: #0e0b08; --card: #181410; --ink: #f4efe8; --mute: #a39a8d; --line: #2a241d; --soft: #1f1a15; --ok: #5fcf8a; --bad: #ff8a80; --side: #080604; color-scheme: dark; } }
* { box-sizing: border-box; margin: 0; }
body { font: 400 15px/1.55 "Be Vietnam Pro", system-ui, sans-serif; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--or-d); }
h1 { font-size: 1.7rem; font-weight: 900; letter-spacing: -.03em; }
h2 { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }
.mut { color: var(--mute); }
.link { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; padding: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 24px; box-shadow: 0 1px 0 rgba(0,0,0,.02), 0 10px 30px -18px rgba(60,30,0,.25); }
label { display: grid; gap: 6px; font-weight: 500; font-size: 13.5px; color: var(--mute); }
input, select, textarea { font: inherit; color: var(--ink); background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%; }
textarea { resize: vertical; min-height: 120px; font-family: ui-monospace, Consolas, monospace; font-size: 13.5px; line-height: 1.55; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--or); outline-offset: 2px; }
.btn { font: 700 14.5px "Be Vietnam Pro", sans-serif; color: #fff; background: var(--or); border: 0; border-radius: 999px; padding: 11px 24px; cursor: pointer; }
.btn:hover { background: var(--or-d); }
.btn[disabled] { opacity: .6; cursor: wait; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--or); background: transparent; }
.btn.sm { padding: 6px 14px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid var(--line); }
.msg { min-height: 1.4em; font-weight: 500; }
.msg.ok { color: var(--ok); } .msg.bad { color: var(--bad); }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 50% -10%, rgba(255,106,43,.22), transparent 70%), var(--bg); }
.login .card { width: min(400px, 100%); display: grid; gap: 14px; }
.login .mark { width: 46px; height: 46px; padding: 11px; border-radius: 14px; background: var(--or); }

.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100dvh; }
.side { background: var(--side); color: #f4efe8; padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100dvh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand img { width: 30px; height: 30px; padding: 6px; background: var(--or); border-radius: 10px; }
.brand b { font-weight: 900; letter-spacing: .02em; } .brand span { color: #a39a8d; font-size: 13px; }
.side nav { display: grid; gap: 4px; }
.side nav a { color: #cfc7bb; text-decoration: none; padding: 10px 14px; border-radius: 14px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.side nav a:hover { background: rgba(255,255,255,.07); }
.side nav a.on { background: var(--or); color: #fff; font-weight: 700; }
.badge { font-style: normal; font-size: 12px; font-weight: 700; background: #fff; color: var(--or-d); border-radius: 999px; padding: 0 8px; }
.sidefoot { margin-top: auto; display: grid; gap: 8px; padding: 0 8px; font-size: 13.5px; color: #a39a8d; }
.sidefoot a { color: inherit; }
main { padding: 32px clamp(16px, 4vw, 44px) 80px; max-width: 1080px; width: 100%; }
main > h1 { margin-bottom: 4px; } main > .mut { margin-bottom: 22px; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat b { display: block; font-size: 2rem; font-weight: 900; letter-spacing: -.03em; line-height: 1.1; }
.stat span { color: var(--mute); font-size: 13.5px; }
.stat.hl { background: var(--or); color: #fff; border-color: transparent; } .stat.hl span { color: rgba(255,255,255,.85); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.stack { display: grid; gap: 14px; }
.hint { font-size: 12.5px; color: var(--mute); font-weight: 400; }
.req::after { content: " *"; color: var(--or); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 7px 16px; cursor: pointer; font: 500 14px "Be Vietnam Pro", sans-serif; }
.tab.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.sec { border: 1px solid var(--line); border-radius: 18px; padding: 16px; background: var(--soft); display: grid; gap: 10px; }
.sec .top { display: flex; gap: 8px; align-items: center; }
.sec .top input { font-weight: 700; }
.pill { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 10px; background: var(--soft); border: 1px solid var(--line); color: var(--mute); white-space: nowrap; }
.pill.new { background: var(--or); color: #fff; border-color: transparent; } .pill.replied { color: var(--ok); } .pill.done { color: var(--mute); }

.list { display: grid; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 14px 6px; cursor: pointer; font: inherit; color: inherit; width: 100%; }
.item:hover { background: var(--soft); } .item.on { background: var(--soft); box-shadow: inset 3px 0 0 var(--or); }
.item .t { font-weight: 700; } .item.unread .t::before { content: "● "; color: var(--or); }
.item .p { grid-column: 1 / -1; color: var(--mute); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.split { display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 16px; align-items: start; }
.msgbody { white-space: pre-wrap; background: var(--soft); border-radius: 14px; padding: 14px; border: 1px solid var(--line); }
.reply { border-left: 3px solid var(--or); padding: 8px 14px; background: var(--soft); border-radius: 0 12px 12px 0; white-space: pre-wrap; }

table { border-collapse: collapse; width: 100%; font-size: 14px; } td, th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; } td:last-child, th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: 200px; display: block; } .chart .g { stroke: var(--line); } .chart .v { fill: var(--or); } .chart .c { fill: #2f2a24; } @media (prefers-color-scheme: dark) { .chart .c { fill: #f4efe8; } } .chart text { fill: var(--mute); font: 11px "Be Vietnam Pro", sans-serif; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--mute); } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--or); } .legend i.c { background: #2f2a24; } @media (prefers-color-scheme: dark) { .legend i.c { background: #f4efe8; } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 11px 22px; border-radius: 999px; font-weight: 500; opacity: 0; pointer-events: none; transition: .25s; z-index: 9; }
.toast.on { opacity: 1; transform: translate(-50%, 0); } .toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; } .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; gap: 10px; }
  .side nav { display: flex; flex-wrap: wrap; order: 3; width: 100%; } .side nav a { padding: 8px 12px; } .sidefoot { margin: 0 0 0 auto; display: flex; gap: 14px; }
  .split { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
