:root {
  --brown: #7a5e06;
  --brown-dark: #423200;
  --yellow: #ffc000;
  --ink: #262626;
  --muted: #61594c;
  --faint: #e9e2d4;
  --line: #c3b49b;
  --paper: #fff;
  --bg: #f8f5ef;
  --soft: #f5f0e5;
  --highlight: #fff4ce;
  color: var(--ink);
  background: var(--bg);
  font: 16px system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
:focus-visible { outline: 3px solid var(--brown); outline-offset: 3px; }
.sidebar :focus-visible { outline-color: var(--yellow); }
[hidden] { display: none !important; }
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(1.9rem, 3.1vw, 2.65rem); line-height: 1.1; margin-bottom: 7px; letter-spacing: -.05em; }
h2 { font-size: 1.16rem; letter-spacing: -.025em; }
p { line-height: 1.5; }
.layout { display: grid; grid-template-columns: 229px minmax(0,1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; padding: 25px 15px; background: linear-gradient(165deg,var(--brown),var(--brown-dark)); color: white; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 770; letter-spacing: -.04em; text-decoration: none; }
.brand-icon { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 10px; background: var(--yellow); color: var(--ink); font-weight: 850; }
.sidebar nav { display: grid; gap: 4px; margin-top: 32px; }
.nav-link { display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.nav-link:hover { background: #0002; }
.nav-link[aria-current="page"] { background: var(--yellow); color: var(--ink); font-weight: 750; }
.workspace { min-width: 0; }
.topbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px clamp(16px,4vw,48px); border-bottom: 1px solid var(--faint); background: white; }
.topbar small { color: var(--muted); }
.content { max-width: 1390px; margin: 0 auto; padding: 33px clamp(16px,4vw,48px) 55px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin: 0 0 22px; }
.page-head p { margin-bottom: 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 41px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); font-size: .9rem; font-weight: 690; text-decoration: none; white-space: nowrap; }
.button:hover { background: var(--highlight); border-color: var(--brown); }
.button.primary { background: var(--yellow); border-color: transparent; }
.button.primary:hover { background: #ffd34a; border-color: var(--brown); }
.button.small { min-height: 33px; padding: 4px 8px; }
.panel { min-width: 0; margin: 0 0 17px; border: 1px solid var(--faint); border-radius: 13px; background: white; box-shadow: 0 10px 24px rgb(66 50 0 / 6%); }
.panel-body { padding: clamp(14px,2vw,22px); }
.form { display: grid; gap: 15px; max-width: 900px; }
label { display: grid; gap: 5px; font-weight: 650; font-size: .9rem; }
input, select, textarea { min-width: 0; min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); }
select { appearance: none; padding-right: 33px; background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23262626' stroke-width='1.5'/%3E%3C/svg%3E") right 9px center / 16px no-repeat; }
textarea { resize: vertical; max-width: 100%; line-height: 1.45; }
.filters { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.filters label:first-child { flex: 1 1 210px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .92rem; }
td, th { padding: 12px 14px; border-bottom: 1px solid var(--faint); }
td:first-child { min-width: 190px; overflow-wrap: anywhere; }
td:not(:first-child), th { white-space: nowrap; }
th { color: white; background: var(--ink); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg); }
.subject { font-weight: 700; text-underline-offset: 3px; }
.subject:hover { color: var(--brown); }
.tag { display: inline-flex; padding: 4px 9px; border-radius: 99px; font-size: .84rem; font-weight: 700; white-space: nowrap; }
.tag.open { background: #fbefd0; color: #704d00; }
.tag.in_progress { background: #e5edf8; color: #234a77; }
.tag.resolved { background: #e4f3ed; color: #23563a; }
.muted, time, .loading { color: var(--muted); font-size: .9rem; }
.loading { padding: 24px; }
.error:empty { display: none; }
.error { padding: 10px 12px; margin: 0; background: #faebea; color: #862625; border-radius: 8px; font-weight: 600; }
.empty { margin: 0; }
.drop-zone { display: grid; justify-items: start; gap: 8px; padding: 17px; border: 2px dashed var(--line); border-radius: 10px; background: var(--bg); }
.drop-zone.dragging { background: var(--highlight); border-color: var(--brown); }
.drop-zone p { margin: 0; }
.file-list { display: grid; gap: 6px; list-style: none; padding: 0; margin: 0; width: 100%; }
.file-list:empty { display: none; }
.file-list li { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: white; border-radius: 8px; padding: 5px 8px; }
.file-list li span { overflow-wrap: anywhere; }
.meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.thread { max-width: 960px; }
.message { padding: 17px; border: 1px solid var(--faint); border-radius: 11px; background: white; margin-bottom: 10px; overflow-wrap: anywhere; }
.message.mine { background: #fffaf0; }
.message-head { display: flex; flex-wrap: wrap; gap: 7px 11px; align-items: baseline; }
.message-head time { margin-left: auto; }
.message-text { white-space: pre-wrap; margin: 8px 0 0; }
.message-files { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 0; }
.attachment { display: grid; gap: 5px; min-width: 0; max-width: 220px; padding: 7px 9px; border: 1px solid var(--faint); border-radius: 8px; background: white; font-size: .89rem; }
.attachment img { display: block; width: auto; max-width: 100%; max-height: 155px; object-fit: contain; }
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(100%,440px); border-top: 5px solid var(--yellow); }
.login-card .brand { color: var(--ink); margin-bottom: 22px; }
.login-card .form { margin-top: 24px; }
.login-card .button { width: 100%; }
@media(max-width:760px) {
  .layout { display: block; }
  .sidebar { position: static; height: auto; display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; padding: 12px 16px; }
  .sidebar nav { display: flex; flex-wrap: wrap; margin: 0; }
  .nav-link { padding: 7px; font-size: .88rem; }
  .topbar { min-height: auto; padding-block: 8px; }
  .content { padding-top: 23px; }
  .page-head { flex-wrap: wrap; }
}
