:root {
  color-scheme: light;
  --ink: #173f37;
  --ink-2: #245b52;
  --muted: #667a74;
  --paper: #f8f5ed;
  --panel: #fffdf8;
  --line: #ded8ca;
  --purple: #7450a6;
  --purple-soft: #f1eafb;
  --mint: #dceee8;
  --gold: #c5953c;
  --ready: #207347;
  --ready-soft: #e3f4e9;
  --danger: #9f3a38;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body {
  background:
    radial-gradient(circle at 85% -10%, rgba(116, 80, 166, .13), transparent 34rem),
    linear-gradient(135deg, #f7f2e8 0%, #f4f7f3 100%);
  color: var(--ink);
}

button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }

.grooming-terminal { min-height: 100vh; }

.terminal-loading,
.terminal-error {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1rem;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
}

.terminal-loading img,
.terminal-error img { width: min(280px, 70vw); }

.terminal-error p { max-width: 34rem; color: var(--muted); }

.terminal-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 100vh;
}

.terminal-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1.25rem;
  align-items: center;
  padding: .85rem 1rem;
  background: rgba(255, 253, 248, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.terminal-brand { display: flex; align-items: center; gap: .85rem; min-width: 0; }
.terminal-brand img { width: 140px; height: auto; }
.terminal-brand p { margin: 0 0 .12rem; color: var(--purple); font-size: .68rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.terminal-brand h1 { margin: 0; font: 900 clamp(1.2rem, 2.2vw, 1.8rem)/1.05 Georgia, serif; }

.terminal-controls { display: flex; justify-content: center; gap: .6rem; min-width: 0; }
.terminal-controls label { display: grid; gap: .18rem; color: var(--muted); font-size: .64rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.terminal-controls select,
.terminal-controls input,
.form-field input,
.form-field select,
.form-field textarea,
.add-form input,
.add-form select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  padding: .65rem .75rem;
  outline: none;
}

.terminal-controls select:focus,
.terminal-controls input:focus,
.form-field input:focus,
.form-field textarea:focus,
.add-form input:focus,
.add-form select:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(116, 80, 166, .12); }

.terminal-actions { display: flex; gap: .45rem; justify-content: flex-end; }
.terminal-button,
.primary-action,
.secondary-action,
.ready-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  padding: .62rem .85rem;
  font-weight: 850;
  text-decoration: none;
}

.terminal-button:hover,
.secondary-action:hover { border-color: var(--purple); color: var(--purple); }
.terminal-button.is-primary,
.primary-action { border-color: var(--purple); background: var(--purple); color: #fff; }
.ready-action { border-color: var(--ready); background: var(--ready); color: #fff; }
.ready-action:disabled { cursor: not-allowed; opacity: .55; }

.terminal-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--line);
}

.summary-card {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 248, .78);
  padding: .65rem .8rem;
}
.summary-card span { color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.summary-card strong { font-size: 1.45rem; }
.summary-card.is-ready { border-color: #a9d0b7; background: var(--ready-soft); color: var(--ready); }

.terminal-workspace {
  display: grid;
  grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
  min-height: 0;
  padding: .75rem 1rem 1rem;
  gap: .75rem;
}

.queue-panel,
.job-panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 253, 248, .9);
  box-shadow: 0 14px 40px rgba(23, 63, 55, .07);
  overflow: hidden;
}

.queue-panel { display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
.queue-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .8rem; border-bottom: 1px solid var(--line); }
.queue-head h2 { margin: 0; font: 900 1.15rem/1 Georgia, serif; }
.queue-search { width: 100%; min-height: 38px; border: 1px solid var(--line); border-width: 0 0 1px; background: #fff; padding: .6rem .8rem; outline: none; }
.queue-filters { display: flex; gap: .35rem; padding: .55rem .65rem; overflow-x: auto; border-bottom: 1px solid var(--line); }
.queue-filter { border: 0; border-radius: 999px; background: #ece9df; color: var(--muted); padding: .42rem .68rem; font-size: .72rem; font-weight: 850; white-space: nowrap; }
.queue-filter.is-active { background: var(--ink); color: #fff; }
.queue-list { min-height: 0; padding: .55rem; overflow-y: auto; }

.queue-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: .65rem;
  align-items: center;
  width: 100%;
  margin: 0 0 .45rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #f5f2ea;
  color: var(--ink);
  padding: .55rem;
  text-align: left;
}
.queue-card:hover { border-color: #b9afa0; }
.queue-card.is-active { border-color: var(--purple); background: var(--purple-soft); box-shadow: inset 4px 0 0 var(--purple); }
.queue-card.is-ready { background: var(--ready-soft); }
.dog-avatar { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; overflow: hidden; background: var(--mint); color: var(--ink); font-weight: 950; }
.dog-avatar img { width: 100%; height: 100%; object-fit: cover; }
.queue-copy { min-width: 0; }
.queue-copy strong, .queue-copy span, .queue-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-copy strong { font-size: .96rem; }
.queue-copy span { color: var(--muted); font-size: .72rem; }
.queue-copy small { margin-top: .18rem; color: var(--purple); font-size: .65rem; font-weight: 850; text-transform: uppercase; }
.queue-time { color: var(--ink-2); font-size: .72rem; font-weight: 900; }
.queue-empty { padding: 2.5rem 1rem; color: var(--muted); text-align: center; }

.job-panel { overflow-y: auto; }
.job-empty { display: grid; place-items: center; align-content: center; gap: .6rem; min-height: 100%; padding: 2rem; color: var(--muted); text-align: center; }
.job-empty strong { color: var(--ink); font: 900 1.6rem/1.1 Georgia, serif; }

.job-header {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(110deg, #fffdf8, #f4edf9);
}
.job-header .dog-avatar { width: 84px; height: 84px; font-size: 1.6rem; }
.job-header h2 { margin: 0 0 .25rem; font: 900 clamp(1.65rem, 3vw, 2.45rem)/1 Georgia, serif; }
.job-header p { margin: .2rem 0; color: var(--muted); }
.job-price { min-width: 110px; text-align: right; }
.job-price span { display: block; color: var(--muted); font-size: .7rem; font-weight: 850; text-transform: uppercase; }
.job-price strong { font-size: 1.5rem; }

.workflow-strip { display: grid; grid-template-columns: repeat(8, minmax(72px, 1fr)); gap: .35rem; padding: .75rem 1rem; overflow-x: auto; border-bottom: 1px solid var(--line); }
.workflow-step { min-height: 48px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--muted); padding: .35rem .45rem; font-size: .7rem; font-weight: 850; }
.workflow-step.is-current { border-color: var(--purple); background: var(--purple); color: #fff; }
.workflow-step.is-done { border-color: #a5c8bc; background: var(--mint); color: var(--ink); }
.workflow-step.is-ready { border-color: var(--ready); background: var(--ready); color: #fff; }

.job-form { padding: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.form-field { display: grid; gap: .3rem; min-width: 0; }
.form-field.is-wide { grid-column: 1 / -1; }
.form-field > span { color: var(--ink-2); font-size: .72rem; font-weight: 900; text-transform: uppercase; }
.form-field textarea { min-height: 92px; resize: vertical; }
.form-field.is-notes textarea { min-height: 120px; }

.photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; margin: 1rem 0; }
.photo-card { position: relative; min-height: 210px; border: 1px dashed #b8ad9c; border-radius: 12px; overflow: hidden; background: #f4f1e9; }
.photo-card img { width: 100%; height: 250px; object-fit: cover; display: block; }
.photo-card label { display: grid; place-items: center; align-content: center; gap: .45rem; min-height: 210px; padding: 1rem; cursor: pointer; color: var(--muted); text-align: center; }
.photo-card label strong { color: var(--ink); }
.photo-card.has-photo label { position: absolute; right: .55rem; bottom: .55rem; min-height: 0; border-radius: 8px; background: rgba(23, 63, 55, .9); color: #fff; padding: .5rem .65rem; }
.photo-card.has-photo label strong { color: #fff; }
.photo-card input { position: absolute; opacity: 0; pointer-events: none; }

.job-footer { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: .55rem; margin: 1rem -1rem -1rem; padding: .75rem 1rem; border-top: 1px solid var(--line); background: rgba(255, 253, 248, .96); backdrop-filter: blur(10px); }
.ready-hint { margin-right: auto; align-self: center; color: var(--muted); font-size: .74rem; }

.add-overlay { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgba(17, 36, 32, .56); }
.add-dialog { width: min(560px, 100%); border-radius: 14px; background: var(--panel); box-shadow: 0 25px 80px rgba(0, 0, 0, .28); overflow: hidden; }
.add-dialog header { display: flex; justify-content: space-between; align-items: center; padding: 1rem; border-bottom: 1px solid var(--line); }
.add-dialog h2 { margin: 0; font: 900 1.4rem/1 Georgia, serif; }
.icon-close { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #eee9df; font-size: 1.2rem; }
.add-form { display: grid; gap: .8rem; padding: 1rem; }
.add-form label { display: grid; gap: .3rem; color: var(--ink-2); font-size: .72rem; font-weight: 900; text-transform: uppercase; }
.add-form footer { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .4rem; }

.terminal-toast { position: fixed; z-index: 50; right: 1rem; bottom: 1rem; max-width: min(420px, calc(100vw - 2rem)); border-radius: 10px; background: var(--ink); color: #fff; padding: .8rem 1rem; box-shadow: 0 12px 34px rgba(0, 0, 0, .2); font-weight: 800; }
.terminal-toast.is-error { background: var(--danger); }

@media (max-width: 900px) {
  .terminal-header { grid-template-columns: 1fr auto; }
  .terminal-controls { grid-column: 1 / -1; grid-row: 2; justify-content: stretch; }
  .terminal-controls label { flex: 1; }
  .terminal-controls select, .terminal-controls input { width: 100%; }
  .terminal-brand img { width: 112px; }
  .terminal-workspace { grid-template-columns: 1fr; grid-template-rows: auto minmax(540px, 1fr); }
  .queue-panel { max-height: 340px; }
}

@media (max-width: 620px) {
  .terminal-header { gap: .65rem; padding: .7rem; }
  .terminal-brand img { width: 88px; }
  .terminal-brand p { display: none; }
  .terminal-brand h1 { font-size: 1.05rem; }
  .terminal-actions .terminal-button:not(.is-primary) { display: none; }
  .terminal-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .6rem .7rem; }
  .terminal-workspace { padding: .6rem .7rem .8rem; }
  .job-header { grid-template-columns: 64px minmax(0, 1fr); }
  .job-header .dog-avatar { width: 64px; height: 64px; }
  .job-price { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; text-align: left; }
  .form-grid, .photo-grid { grid-template-columns: 1fr; }
  .job-footer { flex-wrap: wrap; }
  .ready-hint { flex-basis: 100%; }
  .job-footer button { flex: 1; }
}

