:root {
  --bg: #eef3f9;
  --panel: rgba(255, 255, 255, 0.94);
  --line: #d9e2ef;
  --text: #1f293d;
  --muted: #66758f;
  --sidebar: #273247;
  --sidebar-top: #192235;
  --accent: #2a9d8f;
  --accent-dark: #1f8277;
  --danger: #c74b62;
  --warn: #d9972b;
  --shadow: 0 18px 38px rgba(30, 43, 68, 0.10);
  --shadow-soft: 0 10px 24px rgba(30, 43, 68, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Open Sans", "Segoe UI", Tahoma, Arial, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(42,157,143,0.10), transparent 26%),
    radial-gradient(circle at left 15%, rgba(79,102,196,0.10), transparent 28%),
    linear-gradient(180deg, #f7f9fc 0%, var(--bg) 100%);
  color: var(--text);
}

a { color: #1f7fcb; text-decoration: none; }
a:hover { text-decoration: underline; }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar-top), var(--sidebar));
  color: #e6ebf5;
  padding: 20px 14px;
}

.brand {
  font-size: 19px;
  font-weight: 700;
  margin: 2px 10px 18px;
  letter-spacing: .2px;
}

.nav-link {
  display: block;
  color: #d8deeb;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 6px;
  border: 1px solid transparent;
}

.nav-link:hover {
  text-decoration: none;
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.1);
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.flash-message {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  padding: 10px 20px;
  font-size: 14px;
}

.topbar {
  height: 62px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.topbar-title {
  font-size: 15px;
  color: var(--muted);
}

.topbar-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.branch-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(42, 157, 143, 0.10);
  color: #245d57;
  white-space: nowrap;
}

.branch-badge span {
  color: var(--muted);
  font-size: 13px;
}

.branch-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  flex-wrap: wrap;
}

.branch-switcher label {
  color: var(--muted);
  font-size: 13px;
}

.branch-switcher select {
  min-width: 210px;
}

.content {
  padding: 24px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.page-head > * {
  margin: 0;
}

.page-head .hint {
  max-width: 460px;
  line-height: 1.45;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head h2,
.section-head h3,
.section-head p {
  margin-top: 0;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.section-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.soft-panel {
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid #e2e9f4;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
}

.soft-panel:last-of-type {
  margin-bottom: 0;
}

.archive-details {
  border: 1px solid #dfe7f2;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.archive-details + .archive-details {
  margin-top: 12px;
}

.archive-details summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 700;
  color: #24324a;
}

.archive-details summary::-webkit-details-marker {
  display: none;
}

.archive-details[open] summary {
  border-bottom: 1px solid #dfe7f2;
  background: rgba(79, 102, 196, 0.05);
}

.archive-details .table-wrap {
  margin: 0;
  padding: 0 18px 18px;
}

.archive-body {
  padding: 0 18px 18px;
}

.empty-panel {
  padding: 18px;
  border: 1px dashed #d7e2ef;
  border-radius: 16px;
  background: #f8fbff;
  color: #5e6c84;
}

.services-browser-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.services-browser-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid #d9e5f2;
  border-radius: 999px;
  background: #f7fbff;
  color: #42516a;
  font-weight: 600;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
}

.services-browser-tab:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.services-browser-tab.is-active {
  background: linear-gradient(180deg, #2db5a4 0%, var(--accent) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 12px 22px rgba(42, 157, 143, 0.18);
}

.services-filter-wide {
  flex: 1 1 320px;
}

.services-browser-table .table-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.services-browser-table .table-sort::after {
  content: "⇅";
  font-size: 12px;
  color: #8ba0c0;
}

.services-browser-table .table-sort.is-sorted-asc::after {
  content: "↑";
  color: #2a9d8f;
}

.services-browser-table .table-sort.is-sorted-desc::after {
  content: "↓";
  color: #2a9d8f;
}

.services-browser-table .table-sort:hover {
  color: #22314f;
}

.table-primary-link {
  color: #1f7fcb;
  font-weight: 600;
}

.table-empty-note {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fbff;
  color: #5e6c84;
  border: 1px dashed #d7e2ef;
}

.services-content-grid {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

.category-collection {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.category-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid #dfe7f2;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  box-shadow: var(--shadow-soft);
}

.category-card.is-selected {
  border-color: rgba(42, 157, 143, 0.40);
  box-shadow:
    0 0 0 3px rgba(42, 157, 143, 0.10),
    0 16px 28px rgba(35, 48, 73, 0.08);
}

.category-card.is-inactive {
  background: linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
}

.category-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.category-card-link {
  font-size: 18px;
  font-weight: 700;
  color: #22314f;
}

.category-card-link:hover {
  text-decoration: none;
}

.category-card-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.category-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-card-actions form,
.category-service-list form,
.category-attach-list form {
  margin: 0;
}

.category-services-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.category-attach-panel {
  padding: 18px;
  border: 1px solid #dfe7f2;
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
  box-shadow: var(--shadow-soft);
}

.category-attach-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.category-attach-head h3 {
  margin: 0;
}

.category-attach-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e8f0ff;
  color: #294165;
  font-weight: 700;
  font-size: 13px;
}

.category-attach-search-field {
  width: 100%;
}

.category-attach-search-input {
  background: #fff;
}

.category-attach-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 540px;
  overflow: auto;
  padding: 8px;
  border: 1px solid #dbe4f1;
  border-radius: 16px;
  background: rgba(255,255,255,0.72);
}

.category-attach-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid #dbe4f1;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}

.category-attach-item:hover {
  border-color: #c4d5ed;
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.category-attach-item.is-inactive {
  opacity: 0.7;
  background: #f5f7fb;
}

.category-attach-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.category-attach-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.category-attach-title {
  font-weight: 600;
  color: #24324a;
}

.category-attach-title:hover {
  text-decoration: none;
}

.category-attach-meta {
  font-size: 12px;
  color: var(--muted);
}

.category-attach-item .btn {
  min-width: 108px;
  white-space: nowrap;
  justify-content: center;
}

.category-service-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-service-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border: 1px solid #dfe7f2;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.category-service-card.is-inactive {
  background: linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
}

.category-service-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.category-service-head h3 {
  margin: 0 0 4px;
  color: #22314f;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.summary-card {
  padding: 14px 16px;
  border: 1px solid #dfe7f2;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
  box-shadow: var(--shadow-soft);
}

.summary-card .stat-label {
  display: block;
}

.summary-card .stat-value {
  font-size: 26px;
  margin: 6px 0 2px;
}

.summary-card .hint {
  margin: 0;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
}

.status-pill.is-active {
  background: #e7f7f2;
  color: #1f6b62;
  border-color: rgba(42, 157, 143, 0.22);
}

.status-pill.is-inactive {
  background: #f3f5f9;
  color: #6c7890;
  border-color: #dbe3ef;
}

.status-pill.is-current {
  background: #fff4df;
  color: #8b5a00;
  border-color: #ecd7a8;
}

h1, h2, h3 {
  margin: 0 0 10px;
  font-weight: 700;
  letter-spacing: .2px;
}

h1 { font-size: 24px; }
h2 { font-size: 18px; margin-top: 18px; }
h3 { font-size: 15px; margin-top: 14px; color: var(--muted); }

.card > h1:first-child,
.card > h2:first-child,
.card > h3:first-child {
  margin-top: 0;
}

.toolbar, .filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}

.filter-actions {
  flex-direction: row;
  align-items: end;
}

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

input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(255,255,255,0.96);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(42, 157, 143, 0.55);
  box-shadow: 0 0 0 4px rgba(42, 157, 143, 0.12);
  background: #fff;
}

.select-filter {
  margin-bottom: 6px;
}

.live-combobox {
  position: relative;
}

.live-combobox-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.96);
  overflow: hidden;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.live-combobox-input {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding-right: 8px;
}

.live-combobox-input:focus {
  border: 0;
  box-shadow: none;
  background: transparent;
}

.live-combobox-trigger {
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  justify-content: center;
}

.live-combobox-trigger::before {
  content: "▾";
  font-size: 12px;
}

.live-combobox.is-open .live-combobox-control,
.live-combobox:focus-within .live-combobox-control {
  border-color: rgba(42, 157, 143, 0.55);
  box-shadow: 0 0 0 4px rgba(42, 157, 143, 0.12);
  background: #fff;
}

.live-combobox-panel {
  position: fixed;
  z-index: 90;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px;
  max-height: 260px;
}

.live-combobox-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
}

.live-combobox-option,
.live-combobox-empty {
  border-radius: 10px;
  padding: 9px 10px;
  text-align: left;
}

.live-combobox-option {
  border: 1px solid transparent;
  background: #f6f9fd;
  color: var(--text);
  cursor: pointer;
}

.live-combobox-option:hover,
.live-combobox-option.is-active {
  background: #edf4fb;
}

.live-combobox-option.is-selected {
  background: #dff3ef;
  border-color: rgba(42, 157, 143, 0.28);
}

.live-combobox-option.is-disabled {
  opacity: .6;
  cursor: not-allowed;
}

.live-combobox-empty {
  color: var(--muted);
  background: #f8fafc;
}

textarea { width: min(100%, 760px); }

label { color: var(--muted); font-size: 13px; }

.form-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin: 10px 0;
}

.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-wide { grid-column: 1 / -1; }

.service-checklist {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
}

.service-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  color: #314157;
}

.service-checklist-item.is-disabled {
  opacity: 0.55;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  background: #e7ecf4;
  color: #2a3448;
  font-weight: 600;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}

.btn:hover {
  text-decoration: none;
  filter: brightness(0.98);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.btn-primary {
  background: linear-gradient(180deg, #2db5a4 0%, var(--accent) 100%);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger {
  background: linear-gradient(180deg, #d35d75 0%, var(--danger) 100%);
  color: #fff;
}
.btn-muted {
  background: #f3f6fb;
  color: #37445a;
  border-color: #e2eaf5;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.table th {
  background: #edf2f9;
  color: #3a4860;
  font-weight: 600;
}

.table tr:last-child td { border-bottom: 0; }
.table tr:nth-child(even) td { background: #fbfcfe; }

.inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.note-composer {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.note-composer .form-grid {
  margin: 0;
}

.note-composer textarea {
  width: 100%;
  min-height: 110px;
}

.note-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.note-chip {
  appearance: none;
  border: 1px solid #dfe7f2;
  border-radius: 999px;
  background: #fff;
  color: #33415a;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(35, 48, 73, 0.06);
}

.note-chip:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.note-pin-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #42516a;
  font-size: 14px;
}

.note-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.note-section + .note-section {
  margin-top: 18px;
}

.notes-highlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.note-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.note-card {
  padding: 14px 16px;
  border: 1px solid #dfe7f2;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  box-shadow: 0 10px 22px rgba(35, 48, 73, 0.06);
}

.note-card.is-important {
  background: linear-gradient(180deg, #fff8ec 0%, #fff1d8 100%);
  border-color: #ecd7a8;
}

.note-list .note-card {
  background: #fff;
  box-shadow: none;
}

.note-card.is-empty {
  background: #fbfcfe;
  border-style: dashed;
  box-shadow: none;
}

.note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.note-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef4fb;
  color: #4a5b75;
  font-size: 12px;
  font-weight: 600;
}

.note-badge.is-important {
  background: #fff4df;
  color: #8b5a00;
}

.note-badge.is-author {
  background: #e7f7f2;
  color: #1f6b62;
}

.note-badge.is-time {
  background: #f3f5f9;
  color: #6c7890;
}

.note-text {
  margin: 0;
  color: #22314f;
  line-height: 1.55;
  white-space: pre-wrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #22314f;
}

.alert-danger {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fce9ee;
  color: #8f2740;
  border: 1px solid #f2c7d2;
}

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top right, rgba(42,157,143,0.18), transparent 30%),
    radial-gradient(circle at bottom left, rgba(79,102,196,0.14), transparent 32%),
    var(--bg);
}

.login-shell {
  width: min(100%, 420px);
  padding: 24px;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-actions {
  display: flex;
  justify-content: center;
}

.login-actions .btn {
  min-width: 148px;
  justify-content: center;
}

.login-challenge {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbf7f0;
  min-height: 52px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: #2b3750;
}

.planner-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.planner-main, .planner-right { min-width: 0; }

.planner-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 94px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}

.staff-board {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.staff-board-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border-bottom: 1px dotted #dfe6f4;
  padding-bottom: 10px;
}

.staff-board-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.staff-board-left {
  padding-top: 4px;
}

.staff-name {
  font-weight: 700;
  color: #2b3750;
  line-height: 1.2;
}

.staff-name-link {
  color: inherit;
  text-decoration: none;
}

.staff-name-link:hover {
  text-decoration: underline;
}

.staff-hours {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.staff-board-right {
  --slot-width: 112px;
  --slot-gap: 6px;
  min-height: 42px;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: var(--slot-gap);
  padding-bottom: 4px;
}

.slot-wrap {
  width: var(--slot-width);
  flex: 0 0 auto;
  position: relative;
}

.slot-wrap.is-joined-left {
  margin-left: calc(var(--slot-gap) * -1 + 1px);
  z-index: 1;
}

.slot-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: var(--slot-width);
  min-height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  text-decoration: none;
  padding: 6px 8px;
  font-size: 12px;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

.slot-wrap.is-joined-left .slot-pill {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.slot-wrap.is-joined-right .slot-pill {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.slot-pill:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(44, 62, 92, 0.12);
}

.slot-pill.is-free {
  background: #eef8ef;
  border-color: #c8dfc8;
  color: #40634a;
}

.slot-pill.is-free:hover .slot-book {
  opacity: 1;
}

.slot-pill.is-booked {
  background: #47936f;
  border-color: #37785a;
  color: #fff;
}

.slot-pill.is-status-pending {
  background: linear-gradient(180deg, #fff0c8 0%, #f4d983 100%);
  border-color: #d7b756;
  color: #704d00;
}

.slot-pill.is-status-confirmed {
  background: linear-gradient(180deg, #52b284 0%, #2f8c62 100%);
  border-color: #2a7552;
  color: #fff;
}

.slot-pill.is-status-completed {
  background: linear-gradient(180deg, #e7e5fb 0%, #cfc9f1 100%);
  border-color: #a9a0dc;
  color: #4d468a;
}

.slot-pill.is-status-cancelled {
  background: linear-gradient(180deg, #f4f6fb 0%, #e2e7f2 100%);
  border-color: #c4cede;
  color: #738198;
}

.slot-pill.is-needs-finish {
  background: #fde8e8;
  border-color: #e18a97;
  color: #8f2740;
}

.slot-pill.is-past {
  background: #f3f5f9;
  border-color: #d6dde9;
  color: #8a96ad;
  cursor: not-allowed;
}

.slot-pill.is-closed {
  background: linear-gradient(180deg, #f5efe0 0%, #ead7ad 100%);
  border-color: #d1b46e;
  color: #6c5321;
}

.slot-pill.is-selected {
  box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.22);
}

.slot-title {
  font-weight: 600;
}

.slot-book {
  opacity: .25;
  font-size: 12px;
  transition: opacity .12s ease;
}

.slot-time {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .1px;
}

.slot-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.slot-tooltip {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  min-width: 210px;
  background: #fff;
  border: 1px solid #dce4f2;
  border-radius: 10px;
  box-shadow: 0 10px 22px rgba(32, 43, 67, .15);
  padding: 10px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 30;
  font-size: 12px;
  color: #2a3448;
}

.staff-off {
  border: 1px dashed #dbe4f5;
  border-radius: 10px;
  background: #f9fbff;
  color: #7d8aa2;
  padding: 10px 12px;
  font-size: 13px;
}

.slot-wrap:hover .slot-tooltip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.slot-tooltip-actions {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.slot-tooltip-actions form {
  margin: 0;
}

.slot-trash {
  border: 0;
  background: #fff1f1;
  color: #cc334d;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

.sticky-card {
  position: static;
}

body.has-modal {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(32, 40, 56, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 80;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-backdrop-fullscreen {
  padding: 28px;
}

.modal-panel {
  width: min(100%, 760px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(24, 32, 49, 0.22);
  padding: 18px;
}

.modal-panel-fullscreen {
  width: min(100%, 1100px);
  max-width: 1100px;
  max-height: calc(100vh - 56px);
  border: 1px solid #dfe7f2;
  border-radius: 24px;
  box-shadow: 0 28px 60px rgba(20, 28, 44, 0.28);
  padding: 24px 28px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-close {
  border: 0;
  background: #eef2f8;
  color: #44516a;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.planner-right .card {
  margin-bottom: 0;
}

.toolbar form {
  margin: 0;
}

.mini-cal-widget {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mini-calendar {
  border: 1px solid #dfe7f2;
  border-radius: 18px;
  padding: 12px 10px;
  background: rgba(255,255,255,0.98);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45);
  overflow: hidden;
}

.mini-cal-head {
  --mini-cal-side-width: 80px;
  display: grid;
  grid-template-columns: var(--mini-cal-side-width) minmax(0, 1fr) var(--mini-cal-side-width);
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  color: #202838;
  font-weight: 600;
  text-transform: capitalize;
}

.mini-cal-head-compact {
  --mini-cal-side-width: 68px;
}

.mini-cal-title {
  grid-column: 2;
  justify-self: center;
  margin: 0;
  text-align: center;
  line-height: 1.2;
}

.mini-cal-nav {
  grid-column: 3;
  display: inline-flex;
  gap: 8px;
  justify-self: end;
}

.mini-cal-nav a,
.mini-cal-arrow {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  border: 1px solid #dbe5f2;
  background: #fff;
  box-shadow: 0 8px 18px rgba(35, 48, 73, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #2f3a4f;
  text-decoration: none;
}

.mini-cal-nav a:hover,
.mini-cal-arrow:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.mini-cal-arrow:first-child {
  justify-self: start;
}

.mini-cal-arrow:last-child {
  grid-column: 3;
  justify-self: end;
}

.mini-cal-spacer {
  display: block;
  width: var(--mini-cal-side-width);
  height: 1px;
}

.mini-cal-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  table-layout: fixed;
}

.mini-cal-table th {
  font-size: 11px;
  font-weight: 600;
  color: #69778f;
  text-align: center;
  padding: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.mini-cal-table td {
  padding: 0;
  text-align: center;
}

.mini-cal-day {
  appearance: none;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  border: 0;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #2a3448;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: color .12s ease, box-shadow .12s ease, background .12s ease;
}

.mini-cal-day:hover {
  text-decoration: none;
  background: #eef3fb;
  box-shadow: none;
}

.mini-cal-day.is-muted {
  color: #a8b2c7;
  background: transparent;
}

.mini-cal-day.is-today {
  background: #edf8f5;
  box-shadow: inset 0 0 0 1px rgba(42, 157, 143, 0.45);
}

.mini-cal-day.is-selected {
  background: #d7e4ff;
  color: #1f2e55;
  box-shadow: inset 0 0 0 1px #86a5e5;
}

.staff-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}

.chip-check {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fbfcff;
}

.services-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.specialty-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.specialty-services-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 540px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fbff;
}

.specialty-service-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid #dbe4f1;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}

.specialty-service-item:hover {
  border-color: #c4d5ed;
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.specialty-service-item.is-inactive {
  opacity: 0.7;
  background: #f5f7fb;
}

.specialty-service-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.specialty-service-name {
  font-weight: 600;
  color: #24324a;
}

.specialty-service-meta {
  font-size: 12px;
  color: var(--muted);
}

.specialty-services-empty,
.category-attach-empty {
  padding: 16px;
  border: 1px dashed #d5dfec;
  border-radius: 12px;
  background: #fff;
  text-align: center;
  color: var(--muted);
}

.specialty-summary-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.specialty-selected-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
}

.specialty-selected-total strong {
  font-size: 30px;
  line-height: 1;
  color: #24324a;
}

.specialty-selected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.specialty-selected-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #d6e1f2;
  background: #edf4ff;
  color: #294165;
  font-size: 13px;
}

.specialty-selected-empty {
  color: var(--muted);
  font-size: 13px;
}

.week-grid {
  display: grid;
  gap: 8px;
}

.schedule-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.schedule-tab {
  display: none;
}

.schedule-tab.is-active {
  display: block;
}

.schedule-tab-btn.is-active {
  background: var(--accent);
  color: #fff;
}

.shift-vertical {
  grid-template-columns: 1fr;
  max-width: 420px;
}

.week-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fafcff;
}

.week-enable {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.week-time {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.exception-wrap {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 14px;
}

.exception-kinds {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.exception-kinds label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  line-height: 1.35;
}

.exception-right .form-field,
.vacation-side .form-field {
  margin: 0;
}

.exception-right textarea {
  width: 100%;
}

.ex-sick {
  background: #dff3ff;
  border-color: #8ec9ef;
}

.ex-vacation {
  background: #ffe0e0;
  border-color: #f1aaaa;
}

.ex-other {
  background: #efe7ff;
  border-color: #c4afea;
}

.legend-sick {
  color: #2e7fa9;
  font-weight: 700;
}

.legend-vac {
  color: #b04545;
  font-weight: 700;
}

.legend-other {
  color: #6f4aa4;
  font-weight: 700;
}

.vacation-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 420px;
  gap: 18px;
  align-items: start;
}

.vacation-side form,
.exception-right form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.vacation-side > form {
  margin-bottom: 18px;
}

.vacation-side .form-grid,
.exception-right .form-grid {
  margin: 0;
}

.vacation-side textarea,
.exception-right textarea {
  width: 100%;
}

.vacation-day-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 18px;
}

.vacation-day-actions .btn {
  width: 100%;
  justify-content: center;
}

.vacation-main-action {
  width: 100%;
  justify-content: center;
}

.vacation-slot-modal-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.vacation-slot-modal-value {
  font-size: 20px;
}

.vacation-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.vacation-slot-chip {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f6f9fd;
  color: #2a3448;
  padding: 10px 12px;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.vacation-slot-chip:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.vacation-slot-chip.is-selected {
  background: linear-gradient(180deg, #ffd9e1 0%, #ffc2cf 100%);
  border-color: rgba(199, 75, 98, 0.45);
  color: #821f38;
}

.vacation-slot-chip.is-disabled {
  background: #f3f4f7;
  border-color: #d9dfe9;
  color: #8a96ad;
  cursor: not-allowed;
  text-decoration: line-through;
  box-shadow: none;
}

.staff-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.staff-picker-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
  color: #2a3448;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(35, 48, 73, 0.06);
}

.staff-picker-item:hover {
  text-decoration: none;
  background: linear-gradient(180deg, #ffffff 0%, #f2f7ff 100%);
}

.staff-picker-item span {
  color: var(--muted);
  font-size: 12px;
}

.staff-picker-item.is-active {
  border-color: rgba(62, 148, 104, 0.32);
  background: linear-gradient(180deg, #f1fbf4 0%, #dff5e7 100%);
  box-shadow: 0 14px 26px rgba(62, 148, 104, 0.14);
}

.vacation-cal-table {
  border-spacing: 8px;
}

.vacation-cal-table .mini-cal-day {
  min-height: 46px;
  height: 46px;
  font-size: 15px;
}

.vacation-cal-day.has-exception {
  border-color: rgba(199, 75, 98, 0.28);
  background: #fff0f3;
  color: #8f2740;
}

.vacation-cal-day.is-selected {
  border-color: rgba(199, 75, 98, 0.40);
  background: #ffd6de;
  color: #821f38;
  box-shadow: 0 14px 24px rgba(199, 75, 98, 0.18);
}

.vacation-cal-day.is-range-start,
.vacation-cal-day.is-range-end {
  box-shadow:
    0 0 0 3px rgba(199, 75, 98, 0.18),
    0 14px 24px rgba(199, 75, 98, 0.18);
}

.vacation-cal-day.has-slot-closure::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d9972b;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.85);
}

@media (max-width: 1300px) {
  .planner-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .planner-right {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
  .vacation-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .section-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .specialty-editor-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .category-services-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .specialty-side {
    position: static;
  }
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { padding-bottom: 10px; }
  .content { padding: 12px; }
  .topbar {
    height: auto;
    padding: 12px;
    align-items: flex-start;
    gap: 10px;
    flex-direction: column;
  }
  .topbar-meta {
    width: 100%;
    justify-content: flex-start;
  }
  .branch-switcher select {
    min-width: 0;
    width: 100%;
  }
  .staff-board-row { grid-template-columns: 1fr; }
  .staff-board-right { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .week-row { grid-template-columns: 1fr; }
  .exception-wrap { grid-template-columns: 1fr; }
  .vacation-cal-table .mini-cal-day { min-height: 48px; }
  .page-head {
    flex-direction: column;
  }
  .page-head .hint {
    max-width: none;
  }
  .services-section-head {
    align-items: stretch;
  }
  .services-browser-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
  .category-card-head,
  .category-service-head {
    flex-direction: column;
  }
  .category-attach-item {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }
  .note-actions {
    justify-content: flex-start;
  }
  .mini-cal-head {
    --mini-cal-side-width: 72px;
  }
  .modal-backdrop-fullscreen {
    padding: 12px;
  }
  .modal-panel-fullscreen {
    width: 100%;
    max-height: calc(100vh - 24px);
    border-radius: 18px;
    padding: 18px;
  }
}

/* filter bar */
.filter-bar { margin-bottom: 0; }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.filter-field label { font-size: 12px; color: #666; }
.filter-field input, .filter-field select { padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; }
.filter-actions { flex-direction: row; align-items: center; gap: 6px; }

/* pagination */
.pagination { display: flex; gap: 8px; margin-top: 14px; }

/* status badges */
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.status-confirmed     { background: #d4edda; color: #155724; }
.status-pending_confirmation { background: #fff3cd; color: #856404; }
.status-completed     { background: #cce5ff; color: #004085; }
.status-cancelled     { background: #f8d7da; color: #721c24; }
.status-no_show       { background: #e2e3e5; color: #383d41; }
.status-hold          { background: #fde8c8; color: #7a4f00; }
