@font-face {
  font-family: House;
  src: url(assets/DejaVuSans.ttf);
}
@font-face {
  font-family: House;
  src: url(assets/DejaVuSans-Bold.ttf);
  font-weight: 700;
}
:root {
  --bg: #faf9f6;
  --panel: #fff;
  --text: #293b32;
  --muted: #65716a;
  --border: #e5e7e1;
  --accent: #8b6830;
  --gold: #f4ead7;
  --green: #ebf3ed;
  --red: #a03232;
  --redbg: #fbeeee;
  --blue: #eaf0f8;
  --input: #fff;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #171d19;
  --panel: #202923;
  --text: #e5eae5;
  --muted: #b0bcb2;
  --border: #3c4940;
  --accent: #e1bf80;
  --gold: #463c28;
  --green: #263f31;
  --red: #ffb1ad;
  --redbg: #4b2b2b;
  --blue: #293d52;
  --input: #19221c;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.55 House,
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.62;
}
[hidden] {
  display: none !important;
}
a {
  color: var(--accent);
  overflow-wrap: anywhere;
}
button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 14px;
  line-height: 1.4;
}
button:hover {
  border-color: var(--accent);
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.primary {
  background: #304c3a;
  color: #fff;
  border-color: #304c3a;
}
.primary:hover {
  background: #3b5d46;
}
.text-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 5px 0;
  text-align: left;
  text-decoration: none;
}
.small {
  font-size: 12px;
}
.muted {
  color: var(--muted);
}
.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--muted);
}
h1 {
  font-size: 29px;
  letter-spacing: -1.1px;
  line-height: 1.25;
  margin: 5px 0 12px;
}
h2 {
  font-size: 17px;
  margin: 0 0 16px;
}
h3 {
  font-size: 15px;
  margin: 0 0 8px;
}
p {
  margin: 8px 0 14px;
}
input,
select,
textarea {
  width: 100%;
  background: var(--input);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 11px;
  border-radius: 8px;
  min-width: 0;
}
textarea {
  resize: vertical;
  min-height: 90px;
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
  accent-color: #486c4d;
}
label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  margin: 14px 0;
}
.check {
  flex-direction: row;
  align-items: center;
  color: var(--text);
}
.login-card {
  max-width: 510px;
  margin: 9vh auto;
  padding: 35px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
}
.login-logo {
  width: 190px;
  max-width: 80%;
  background: white;
  padding: 10px;
  border-radius: 5px;
}
.login-card h1 {
  margin-top: 20px;
}
.login-card .primary {
  width: 100%;
}
#login-status {
  margin-top: 25px;
  color: var(--accent);
}
.sidebar {
  width: 228px;
  position: fixed;
  inset: 0 auto 0 0;
  padding: 32px 22px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 4;
}
.brand {
  text-decoration: none;
  display: block;
  margin-bottom: 37px;
  color: var(--muted);
  font-size: 11px;
}
.brand img {
  display: block;
  width: 170px;
  background: #fff;
  border-radius: 4px;
  padding: 7px;
  margin-bottom: 12px;
}
.brand span {
  margin-left: 8px;
}
.sidebar nav {
  display: grid;
  gap: 6px;
}
.sidebar nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 12px 14px;
  border-radius: 9px;
  display: flex;
  gap: 13px;
  align-items: center;
  white-space: nowrap;
}
.sidebar nav a.active {
  background: var(--green);
  color: var(--text);
  font-weight: 700;
}
.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 8px;
}
.sidebar-bottom p {
  margin-bottom: 0;
}
.workspace {
  margin-left: 228px;
}
header {
  height: 83px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 34px;
}
.header-controls {
  display: flex;
  align-items: center;
  gap: 18px;
}
.header-controls input {
  max-width: 260px;
  font-size: 12px;
}
.theme-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
}
.theme-label select {
  width: 100px;
  font-size: 12px;
  padding: 7px;
}
.connection-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 10px 34px;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.connection-bar span {
  flex: 1;
}
.connection-bar.error {
  background: var(--redbg);
  color: var(--red);
}
main {
  max-width: 1480px;
  margin: auto;
  padding: 32px 34px 50px;
  min-height: 70vh;
}
footer {
  border-top: 1px solid var(--border);
  padding: 22px 34px;
  color: var(--muted);
  font-size: 10px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 22px;
  margin-bottom: 24px;
}
.page-head p {
  color: var(--muted);
  margin: 8px 0;
}
.page-head .primary {
  white-space: nowrap;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}
.metric,
.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.metric {
  padding: 20px;
}
.metric span {
  font-size: 11px;
  color: var(--muted);
}
.metric strong {
  display: block;
  font-size: 29px;
  line-height: 1.5;
}
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  gap: 22px;
}
.panel {
  padding: 22px;
  margin-bottom: 20px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.panel-head h2 {
  margin: 0;
}
.list-row {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  display: flex;
  align-items: flex-start;
  gap: 13px;
}
.list-row:first-child {
  border: 0;
}
.row-info {
  flex: 1;
  min-width: 0;
}
.row-info p {
  margin: 5px 0;
}
.row-info button {
  border: 0;
  padding: 0;
  font-weight: 700;
  background: none;
  text-align: left;
}
.row-info small {
  display: block;
  color: var(--muted);
  margin-top: 6px;
}
.pill {
  display: inline-block;
  max-width: 100%;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--gold);
  color: var(--accent);
  font-size: 10px;
  vertical-align: middle;
  overflow-wrap: anywhere;
}
.pill.green {
  background: var(--green);
  color: var(--text);
}
.pill.red {
  background: var(--redbg);
  color: var(--red);
}
.pill.blue {
  background: var(--blue);
  color: var(--text);
}
.pill.gray {
  background: var(--bg);
  color: var(--muted);
}
.pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.card {
  padding: 22px;
  overflow-wrap: anywhere;
}
.card h3 {
  margin-top: 16px;
}
.card button {
  margin-top: 13px;
}
.card .money {
  display: block;
  margin-top: 20px;
  font-weight: 700;
}
.empty {
  padding: 32px 18px;
  color: var(--muted);
  text-align: center;
}
.notice {
  padding: 15px 18px;
  border-radius: 9px;
  background: var(--gold);
  color: var(--accent);
  margin-bottom: 20px;
  font-size: 12px;
}
.tabs {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.tabs button.active {
  background: var(--green);
  border-color: var(--muted);
}
.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--green);
  font-weight: 700;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 24px;
}
.form-error {
  color: var(--red);
  background: var(--redbg);
  padding: 12px;
  border-radius: 6px;
  margin-top: 15px;
}
.timeline {
  position: relative;
}
.event {
  padding: 0 0 25px 24px;
  border-left: 2px solid var(--border);
  margin-left: 6px;
  position: relative;
  overflow-wrap: anywhere;
}
.event:before {
  content: "";
  position: absolute;
  left: -6px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}
.event.agreement:before {
  background: var(--accent);
}
.event.inquiry:before {
  background: #6683a8;
}
.event.task:before,
.event.payment:before {
  background: #64936e;
}
.event p {
  white-space: pre-wrap;
}
.event small {
  color: var(--muted);
  font-size: 10px;
}
.client-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}
.client-header h1 {
  margin: 0;
}
.client-header p {
  margin: 3px 0;
}
.client-header .avatar {
  width: 60px;
  height: 60px;
  font-size: 24px;
}
.timeline-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 23px;
}
.timeline-controls input {
  flex: 1;
}
.timeline-controls select {
  width: 155px;
}
.order-work {
  border: 1px solid var(--border);
  border-radius: 9px;
  margin: 12px 0;
  padding: 13px;
}
.order-work summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}
.order-work summary span:last-child {
  color: var(--muted);
}
.substeps {
  padding-left: 12px;
  border-left: 2px solid var(--border);
}
.substeps label {
  color: var(--text);
}
dialog {
  padding: 30px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 15px;
  width: min(720px, calc(100% - 30px));
  max-height: 90dvh;
}
dialog::backdrop {
  background: #0b1c16a6;
  backdrop-filter: blur(3px);
}
.dialog-close {
  position: absolute;
  right: 12px;
  top: 10px;
  border: 0;
  font-size: 23px;
  background: transparent;
}
dialog h2 {
  margin-right: 20px;
  font-size: 23px;
}
.table-wrap {
  overflow-x: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 540px;
}
th,
td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
}
th {
  font-size: 10px;
  color: var(--muted);
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  background: #304c3a;
  color: white;
  padding: 14px 22px;
  border-radius: 10px;
  z-index: 20;
  box-shadow: 0 5px 30px #0003;
  font-size: 12px;
  max-width: 90vw;
}
.toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.channel-draft {
  border-top: 1px solid var(--border);
  margin-top: 25px;
  padding-top: 18px;
}
@media (min-width: 1600px) {
  main {
    padding-top: 45px;
  }
  .cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 1200px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sidebar {
    width: 205px;
    padding: 25px 15px;
  }
  .workspace {
    margin-left: 205px;
  }
  .brand img {
    width: 165px;
  }
  .grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .metrics {
    gap: 10px;
  }
  .metric {
    padding: 16px;
  }
  .metric strong {
    font-size: 24px;
  }
  .metric span {
    font-size: 10px;
  }
}
@media (max-width: 760px) {
  .sidebar {
    position: sticky;
    inset: auto;
    top: 0;
    width: 100%;
    padding: 10px 15px 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    display: block;
  }
  .brand {
    display: flex;
    gap: 14px;
    align-items: center;
    margin: 0 0 6px;
  }
  .brand img {
    width: 112px;
    margin: 0;
    padding: 4px;
  }
  .brand span {
    font-size: 10px;
    margin: 0;
  }
  .sidebar > .eyebrow,
  .sidebar-bottom {
    display: none;
  }
  .sidebar nav {
    display: flex;
    overflow-x: auto;
    gap: 4px;
  }
  .sidebar nav a {
    padding: 10px 12px;
    font-size: 11px;
    gap: 5px;
  }
  .workspace {
    margin: 0;
  }
  header {
    height: auto;
    min-height: 67px;
    padding: 12px 17px;
    flex-wrap: wrap;
    gap: 7px;
  }
  #breadcrumb {
    font-size: 12px;
  }
  .header-controls {
    gap: 10px;
  }
  .header-controls input {
    width: 160px;
    padding: 8px;
  }
  .theme-label {
    margin: 0;
    font-size: 0;
  }
  .theme-label select {
    width: 86px;
    font-size: 10px;
  }
  .connection-bar {
    padding: 9px 17px;
    gap: 12px;
    font-size: 10px;
  }
  main {
    padding: 24px 17px 35px;
  }
  h1 {
    font-size: 24px;
  }
  .page-head {
    gap: 10px;
  }
  .page-head .primary {
    font-size: 11px;
    padding: 10px;
  }
  .page-head p {
    font-size: 11px;
  }
  .metrics {
    grid-template-columns: 1fr 1fr;
  }
  .metric {
    padding: 14px;
  }
  .metric strong {
    font-size: 26px;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .panel,
  .card {
    padding: 18px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .timeline-controls {
    flex-wrap: wrap;
  }
  .timeline-controls input {
    min-width: 150px;
  }
  .timeline-controls select {
    width: 140px;
  }
  .client-header {
    gap: 12px;
    align-items: flex-start;
  }
  .client-header .avatar {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
  .client-header h1 {
    font-size: 22px;
  }
  dialog {
    padding: 25px 20px;
  }
  .list-row {
    gap: 9px;
  }
  .list-row > button {
    font-size: 11px;
    padding: 8px;
  }
  .login-card {
    margin: 5vh 15px;
    padding: 28px 22px;
  }
  .login-card h1 {
    font-size: 26px;
  }
  footer {
    padding: 20px 17px;
    font-size: 9px;
  }
  .grid {
    gap: 0;
  }
}

.cards {
  margin-bottom: 22px;
}

/* History filters only update the timeline; note drafts stay mounted. */
#client-timeline .timeline-controls {
  flex-wrap: wrap;
  margin-bottom: 12px;
}
#client-timeline .timeline-controls input {
  min-width: 150px;
}
#client-timeline .timeline-controls select {
  width: auto;
  max-width: 100%;
}
#timeline-advanced summary {
  cursor: pointer;
  color: var(--muted);
  padding: 8px 0;
}
.history-filters {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  padding-top: 8px;
}
.history-filters label,
.history-filters input,
.history-filters select {
  min-width: 0;
  width: 100%;
}
.history-filter-reset {
  margin: 8px 0 20px;
}
#timeline-count {
  text-align: right;
}
@media (max-width: 760px) {
  .history-filters {
    grid-template-columns: 1fr;
  }
  #client-timeline .timeline-controls select {
    width: 100%;
  }
}

@media (max-width: 760px) {
  #client-timeline > .panel-head {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }
  #client-timeline > .panel-head h2 {
    width: 100%;
  }
  #timeline-count {
    text-align: left;
    white-space: nowrap;
  }
}
