/* STEP 6-3: Local-first Domain workspace. */
.domain-workspace-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 250px;
  gap: 12px;
  align-items: start;
  min-height: 610px;
}
.domain-directory,
.domain-workbench,
.domain-assignment-panel { box-sizing: border-box; min-width: 0; padding: 15px; }
.domain-directory,
.domain-assignment-panel { position: sticky; top: 8px; }
.domain-panel-heading,
.domain-content-section > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.domain-load-state { margin: 10px 0; padding: 7px; border-radius: 6px; background: #f5efe8; color: #8a7c72; font-size: 7px; }
.domain-load-state.success { background: #edf4ee; color: #55755d; }
.domain-load-state.error { background: #fbefed; color: #a24f4b; }
.domain-tabs { display: grid; gap: 7px; }
.domain-tab {
  box-sizing: border-box;
  width: 100%;
  min-height: 58px;
  padding: 8px;
  border: 1px solid #e0d5ca;
  border-radius: 7px;
  background: #fff;
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) 31px;
  align-items: center;
  gap: 8px;
  text-align: left;
  color: #4f443d;
  cursor: pointer;
}
.domain-tab:hover { border-color: var(--domain-color); background: #fffaf4; }
.domain-tab.on { border-color: var(--domain-color); box-shadow: inset 3px 0 var(--domain-color); }
.domain-tab > span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #f1ebe4; color: var(--domain-color); }
.domain-tab svg { width: 14px; }
.domain-tab b,
.domain-tab small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.domain-tab b { font-size: 9px; }
.domain-tab small { margin-top: 3px; color: #988a80; font-size: 7px; }
.domain-tab em { font: 700 9px Georgia; color: var(--domain-color); text-align: right; }
.domain-empty-state { min-height: 530px; display: grid; place-content: center; justify-items: center; text-align: center; color: #8f8076; }
.domain-empty-state.hidden,
.domain-live-view.hidden { display: none; }
.domain-empty-state > span { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: #f2e9df; }
.domain-empty-state svg { width: 24px; }
.domain-empty-state h2 { margin: 12px 0 5px; font: 700 18px Georgia; color: #4a3e36; }
.domain-empty-state p { max-width: 280px; margin: 0; font-size: 9px; line-height: 1.6; }
.domain-overview { position: relative; padding: 3px 72px 13px 2px; border-bottom: 1px dashed #ddd0c4; }
.domain-overview-kicker { display: flex; align-items: center; gap: 7px; }
.domain-overview-kicker small { color: var(--domain-color); font: 700 8px Georgia; }
.domain-live-status { padding: 4px 7px; border-radius: 9px; background: #eaf3eb; color: #587c62; font-size: 7px; }
.domain-live-title { margin: 8px 0 4px; font: 700 23px/1.15 Georgia, "Songti SC", serif; color: #352d28; }
.domain-live-description { max-width: 620px; margin: 0; color: #786b62; font-size: 9px; line-height: 1.6; }
.domain-overview-actions { position: absolute; right: 0; top: 0; display: flex; gap: 5px; }
.domain-overview-actions button,
.domain-assignment-panel article button { width: 29px; height: 29px; padding: 0; border: 1px solid #ded2c8; border-radius: 7px; background: #fff; color: #655950; display: grid; place-items: center; cursor: pointer; }
.domain-overview-actions button:last-child { color: #b65450; }
.domain-overview-actions svg,
.domain-assignment-panel article svg { width: 13px; }
.domain-metrics { display: grid; grid-template-columns: 1fr 1fr .75fr; gap: 8px; margin: 12px 0; }
.domain-metrics article { min-width: 0; padding: 11px; border: 1px dashed #d9c8b4; border-radius: 7px; background: #fffcf6; }
.domain-metrics small,
.domain-metrics span { display: block; color: #95867a; font-size: 7px; }
.domain-metrics strong { display: block; margin: 4px 0; font: 700 22px Georgia; color: var(--domain-color); }
.domain-metrics i,
.domain-card-progress i { display: block; height: 5px; margin: 7px 0; border-radius: 5px; background: #eee4db; overflow: hidden; }
.domain-metrics i em,
.domain-card-progress i em { display: block; height: 100%; border-radius: inherit; background: var(--domain-color); transition: width .2s ease; }
.domain-content-section { margin-top: 14px; }
.domain-content-section > header > span { padding-top: 5px; color: #8f8176; font-size: 8px; }
.domain-project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.domain-project-card { padding: 11px; border: 1px solid #e1d6cc; border-left: 3px solid var(--domain-color); border-radius: 7px; background: #fff; }
.domain-project-card > header,
.domain-project-card > footer { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.domain-project-card > header > span { padding: 3px 6px; border-radius: 8px; background: #f2ece5; color: #7a6c62; font-size: 7px; }
.domain-project-card select,
.domain-task-row select { height: 25px; min-width: 0; border: 1px solid #ddd2c8; border-radius: 6px; background: #fff; color: #665950; font-size: 7px; padding: 0 4px; }
.domain-project-card > a { display: block; margin: 8px 0; color: inherit; text-decoration: none; }
.domain-project-card h3 { margin: 0; font: 700 13px Georgia; color: #3e342e; }
.domain-project-card p { min-height: 28px; margin: 4px 0 0; color: #877970; font-size: 8px; line-height: 1.5; }
.domain-card-progress { display: grid; grid-template-columns: 1fr 32px; gap: 7px; align-items: center; }
.domain-card-progress strong { font: 700 9px Georgia; color: var(--domain-color); }
.domain-project-card > footer { margin-top: 7px; padding-top: 7px; border-top: 1px dashed #e4dad2; color: #92847a; font-size: 7px; }
.domain-task-list { display: grid; gap: 2px; margin-top: 8px; }
.domain-task-row { min-height: 43px; display: grid; grid-template-columns: 23px minmax(0, 1fr) 112px; align-items: center; gap: 8px; border-bottom: 1px dashed #e5dbd2; }
.domain-task-row > button { width: 21px; height: 21px; padding: 0; border: 1.5px solid #b9a99c; border-radius: 50%; background: #fff; color: #fff; font-size: 11px; }
.domain-task-row.done > button { border-color: #57906a; background: #57906a; }
.domain-task-row.done > span b { text-decoration: line-through; color: #a79c93; }
.domain-task-row > span b,
.domain-task-row > span small { display: block; }
.domain-task-row > span b { font-size: 9px; }
.domain-task-row > span small { margin-top: 2px; color: #998b81; font-size: 7px; }
.domain-task-row > em { justify-self: end; padding: 4px 7px; border-radius: 8px; background: #f2ece5; color: #77685f; font-size: 7px; }
.domain-content-empty,
.domain-list-empty { margin: 8px 0; color: #998b81; font-size: 8px; }
.domain-activity-list { display: grid; margin-top: 8px; }
.domain-activity-list article { min-height: 39px; display: grid; grid-template-columns: 29px minmax(0, 1fr) auto; align-items: center; gap: 8px; border-bottom: 1px dashed #e5dbd2; }
.domain-activity-list article > span { width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center; background: #f3ede7; color: var(--domain-color); }
.domain-activity-list svg { width: 12px; }
.domain-activity-list b,
.domain-activity-list small { display: block; }
.domain-activity-list b { font-size: 8px; }
.domain-activity-list small,
.domain-activity-list time { margin-top: 2px; color: #998b81; font-size: 7px; }
.domain-assignment-panel > section { margin-top: 14px; padding-top: 11px; border-top: 1px dashed #ddd1c7; }
.domain-assignment-panel > section > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.domain-assignment-panel > section > header b { font-size: 9px; }
.domain-assignment-panel > section > header small { min-width: 19px; padding: 3px; border-radius: 9px; background: #eee7e0; text-align: center; font-size: 7px; }
.domain-assignment-panel section article { min-height: 38px; display: grid; grid-template-columns: minmax(0, 1fr) 29px; align-items: center; gap: 5px; border-bottom: 1px dashed #e5dbd2; }
.domain-assignment-panel article span b,
.domain-assignment-panel article span small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.domain-assignment-panel article span b { font-size: 8px; }
.domain-assignment-panel article span small { margin-top: 2px; color: #9a8c82; font-size: 7px; }
.domain-boundary-note { margin: 14px 0 0; padding: 9px; border-left: 3px solid #d0a054; background: #fff8e9; color: #826d4d; font-size: 7px; line-height: 1.55; }
.domain-editor-overlay { position: fixed; inset: 0; z-index: 1450; display: grid; place-items: center; padding: 20px; background: rgba(49, 39, 32, .48); backdrop-filter: blur(2px); }
.domain-editor-overlay.hidden { display: none; }
.domain-editor-card { position: relative; box-sizing: border-box; width: min(500px, calc(100vw - 30px)); padding: 22px; border: 1px solid #ded0c3; border-radius: 8px; background: #fffaf2; box-shadow: 0 22px 50px rgba(42, 30, 22, .25); }
.domain-editor-card > small { color: #6f91a8; font: 700 8px Georgia; }
.domain-editor-card h3 { margin: 5px 0 14px; font: 700 21px Georgia; color: #3c322c; }
.domain-editor-card > label,
.domain-form-grid label { display: grid; gap: 5px; margin-top: 9px; color: #78695f; font-size: 8px; }
.domain-editor-card input,
.domain-editor-card textarea,
.domain-editor-card select { box-sizing: border-box; width: 100%; border: 1px solid #d9ccc1; border-radius: 6px; background: #fff; padding: 8px; color: #473c35; font: inherit; }
.domain-editor-card textarea { min-height: 68px; resize: vertical; }
.domain-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.domain-editor-card footer { display: flex; justify-content: flex-end; gap: 7px; margin-top: 16px; }
.domain-editor-card footer button { height: 31px; padding: 0 12px; border: 1px solid #d8cbc1; border-radius: 7px; background: #fff; color: #564940; font-size: 8px; }
.domain-editor-card footer button:last-child { border-color: #453a33; background: #453a33; color: #fff; }
.domain-editor-close { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border: 0; background: transparent; color: #786a60; }
.domain-editor-close svg { width: 15px; }

@media (max-width: 1160px) {
  .domain-workspace-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .domain-assignment-panel { position: static; grid-column: 1 / -1; }
  .domain-assignment-panel > section { display: inline-block; vertical-align: top; width: calc(50% - 8px); margin-right: 8px; }
}
@media (max-width: 760px) {
  .domain-workspace-shell { grid-template-columns: 1fr; min-height: 0; }
  .domain-directory { position: static; }
  .domain-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .domain-project-grid { grid-template-columns: 1fr; }
  .domain-assignment-panel { grid-column: auto; }
  .domain-assignment-panel > section { display: block; width: auto; margin-right: 0; }
  .domain-metrics { grid-template-columns: 1fr 1fr; }
  .domain-metrics article:last-child { grid-column: 1 / -1; }
  .domain-task-row { grid-template-columns: 23px minmax(0, 1fr); }
  .domain-task-row select,
  .domain-task-row > em { grid-column: 2; justify-self: stretch; }
  .domain-form-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .domain-tabs,
  .domain-metrics,
  .domain-form-grid { grid-template-columns: 1fr; }
  .domain-live-title { font-size: 19px; }
  .domain-metrics article:last-child { grid-column: auto; }
  .domain-project-card > header { align-items: flex-start; flex-direction: column; }
  .domain-project-card select { width: 100%; }
}
