/* Docket — a shared task inbox
   Type: Georgia-led serif for task content, system sans for interface chrome.
   Color: warm paper ground, deep teal brand ink, four solid status stamps. */

:root {
  --paper: #eae7dc;
  --surface: #ffffff;
  --ink: #21261f;
  --ink-soft: #5b6158;
  --ink-faint: #838a7e;
  --line: #cfc9b8;
  --line-soft: #ddd8c9;
  --teal: #1f5c6b;
  --teal-dark: #163f49;
  --rust: #8f3226;

  --status-todo: #4a5560;
  --status-in-progress: #7a5410;
  --status-blocked: #8f3226;
  --status-done: #2f5c3d;

  --font-serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius-s: 3px;
  --transition-fast: 140ms ease;
  --transition-panel: 220ms ease;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body.panel-open {
  overflow: hidden;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
}

p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Focus visibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Layout */
.app {
  max-width: 1240px;
  margin: 0 auto;
}

.topbar {
  padding: 32px 40px 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  background: var(--teal);
  color: var(--paper);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 22px;
  border-radius: var(--radius-s);
}

.brand-text h1 {
  font-family: var(--font-serif);
  font-size: 26px;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.brand-text p {
  margin-top: 4px;
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 52ch;
}

.workspace {
  display: flex;
  align-items: flex-start;
  gap: 36px;
  padding: 28px 40px 56px;
}

.rail {
  width: 250px;
  flex-shrink: 0;
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

/* Controls */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--ink-faint);
  pointer-events: none;
}

#search-input {
  width: 100%;
  padding: 9px 12px 9px 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  transition: border-color var(--transition-fast);
}

#search-input:hover {
  border-color: var(--ink-faint);
}

#search-input:focus-visible {
  border-color: var(--teal);
}

/* Custom select chevron, kept a native <select> */
select {
  width: 100%;
  padding: 9px 30px 9px 12px;
  background: var(--surface) url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 8"%3E%3Cpath d="M1 1l5 5 5-5" fill="none" stroke="%235b6158" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/%3E%3C/svg%3E') no-repeat right 10px center;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--transition-fast);
}

select:hover {
  border-color: var(--ink-faint);
}

select:focus-visible {
  border-color: var(--teal);
}

/* Legend */
.legend-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.legend-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.legend-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  cursor: pointer;
  text-align: left;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.legend-btn:hover {
  background: var(--surface);
  border-color: var(--line);
}

.legend-btn.active {
  background: var(--surface);
  border-color: var(--ink-faint);
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
  background: var(--ink-faint);
}

.legend-dot.dot-todo {
  background: var(--status-todo);
}

.legend-dot.dot-in-progress {
  background: var(--status-in-progress);
}

.legend-dot.dot-blocked {
  background: var(--status-blocked);
}

.legend-dot.dot-done {
  background: var(--status-done);
}

.legend-name {
  display: flex;
  align-items: center;
  font-size: 13.5px;
}

.legend-count {
  font-size: 13px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* Result count */
.result-count {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

/* Docket list */
.docket-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.item + .item {
  border-top: 1px solid var(--line-soft);
}

.item-button {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.item-button:hover {
  background: #f6f4ec;
}

.item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.item-heading {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.item-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}

.item-due {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}

.due-text {
  font-size: 12.5px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.overdue-tag {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--rust);
  border: 1px solid var(--rust);
  border-radius: 2px;
  padding: 1px 6px;
  white-space: nowrap;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--ink-soft);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.meta-item:first-child {
  padding-left: 0;
  border-left: none;
}

.meta-item.comments svg {
  color: var(--ink-faint);
}

/* Stamp / status tag */
.stamp {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 3px 10px 3px 9px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fdfcf8;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
}

.stamp-todo {
  background: var(--status-todo);
}

.stamp-in-progress {
  background: var(--status-in-progress);
}

.stamp-blocked {
  background: var(--status-blocked);
}

.stamp-done {
  background: var(--status-done);
}

/* Empty state */
.empty-state {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 40px 28px;
  text-align: left;
  max-width: 46ch;
}

.empty-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.empty-body {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 18px;
}

.btn-secondary {
  padding: 9px 16px;
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: var(--radius-s);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--ink);
  color: var(--surface);
}

/* Scrim */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(33, 38, 31, 0.32);
  z-index: 40;
}

.scrim[hidden] {
  display: none;
}

/* Detail panel */
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(460px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 28px rgba(33, 38, 31, 0.1);
  z-index: 50;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--transition-panel);
}

.detail-panel.open {
  transform: translateX(0);
}

.detail-inner {
  padding: 28px 28px 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.close-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 7px 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.close-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.detail-title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.28;
  color: var(--ink);
}

.fact-list {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 16px;
  row-gap: 8px;
  margin: 0;
  padding: 16px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.fact-list dt {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}

.fact-list dd {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink);
}

.status-control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status-control-group select {
  max-width: 220px;
}

.status-feedback {
  min-height: 18px;
  font-size: 13px;
  color: var(--teal-dark);
  font-weight: 600;
}

.detail-body {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.62;
  color: var(--ink);
  max-width: 60ch;
}

.detail-body p + p {
  margin-top: 1em;
}

.detail-comments {
  font-size: 13px;
  color: var(--ink-soft);
  padding-top: 4px;
  border-top: 1px solid var(--line-soft);
}

/* Responsive: narrow viewports */
@media (max-width: 760px) {
  .topbar {
    padding: 22px 18px 16px;
  }

  .brand-text h1 {
    font-size: 22px;
  }

  .workspace {
    flex-direction: column;
    padding: 18px 16px 40px;
    gap: 18px;
  }

  .rail {
    width: 100%;
    position: static;
    flex-direction: column;
    gap: 14px;
  }

  .legend-list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .legend-btn {
    width: auto;
  }

  .item-top {
    flex-direction: column;
    gap: 8px;
  }

  .item-due {
    padding-top: 0;
  }

  .detail-panel {
    width: 100%;
  }

  .detail-inner {
    padding: 20px 18px 40px;
  }

  .detail-title {
    font-size: 21px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .detail-panel,
  .item-button,
  .legend-btn,
  #search-input,
  select,
  .btn-secondary,
  .close-btn {
    transition: none !important;
  }
}
