/* ─── Top Bar ───────────────────────────────────── */
.topbar {
  background: #1c2333;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.2px;
}

.topbar-brand .brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─── Page Header ───────────────────────────────── */
.page-header {
  background: #fff;
  border-bottom: 1px solid #e5e9f0;
  padding: 20px 24px 16px;
}

.page-title {
  font-size: 20px;
  font-weight: 600;
  color: #1c2333;
  margin: 0 0 2px;
}

.page-subtitle {
  font-size: 13px;
  color: #6b7a99;
  margin: 0;
}

/* ─── Stats Strip ───────────────────────────────── */
.stats-strip {
  display: flex;
  gap: 0;
  background: #fff;
  border-bottom: 1px solid #e5e9f0;
  padding: 0 24px;
  overflow-x: auto;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px 14px 0;
  margin-right: 24px;
  border-right: 1px solid #e5e9f0;
  white-space: nowrap;
}

.stat-item:last-child {
  border-right: none;
}

.stat-num {
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  font-family: 'IBM Plex Mono', monospace;
}

.stat-lbl {
  font-size: 11px;
  color: #6b7a99;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ─── Toolbar ───────────────────────────────────── */
.toolbar {
  padding: 16px 24px;
  display: flex;
  background: #fff;
  border-radius: 7px;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 300px;
  max-width: 100%;
}

.search-box i {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ba8c0;
  font-size: 13px;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  border: 1px solid var(--input-form-light);
  border-radius: 8px;
  padding: 8px 12px 8px 34px;
  font-size: 13px;
  font-family: inherit;
  background: var(--neutral-50);
  outline: none;
  transition: border .15s;
}

.search-box input:focus {
  border-color: #ffb00f;
}

.filter-select {
  border: 1px solid #dde2ee;
  border-radius: 8px;
  padding: 8px 32px 8px 12px;
  font-size: 13px;
  font-family: inherit;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ba8c0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
}

.filter-select:focus {
  border-color: #4f6ef7;
}

.btn-add-main {
  background: #4f6ef7;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, transform .1s;
  margin-left: auto;
}

.btn-add-main:hover {
  background: #3b57e8;
}

.btn-add-main:active {
  transform: scale(.97);
}

/* ─── Cards Grid ─────────────────────────────────── */
.sections-grid {
  padding: 0 24px 40px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px;
}

/* ─── Section Card ───────────────────────────────── */
.section-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e5e9f0;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}


/* Card accent bar on left via border-left on header */
.card-header-bar {
  padding: 16px 18px 14px;
  border-bottom: 1px solid #f0f2f5;
  display: flex;
  align-items: center;
  gap: 12px;
  border-left: 4px solid transparent;
}

/* Each section gets a unique accent */
.accent-brand {
  border-left-color: var(--brand);
}

.accent-blue {
  border-left-color: #4f6ef7;
}

.accent-teal {
  border-left-color: #0db9a0;
}

.accent-orange {
  border-left-color: #f97316;
}

.accent-rose {
  border-left-color: #f43f5e;
}

.accent-violet {
  border-left-color: #8b5cf6;
}

.card-section-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.icon-brand {
  background: #faebce;
  color: var(--brand);
}

.icon-blue {
  background: #eef1fe;
  color: #4f6ef7;
}

.icon-teal {
  background: #e6faf8;
  color: #0db9a0;
}

.icon-orange {
  background: #fff3e8;
  color: #f97316;
}

.icon-rose {
  background: #fff1f3;
  color: #f43f5e;
}

.icon-violet {
  background: #f3efff;
  color: #8b5cf6;
}

.card-section-name {
  font-weight: 600;
  font-size: 15px;
  color: #1c2333;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-section-meta {
  font-size: 11.5px;
  color: #6b7a99;
  margin-top: 2px;
}

.card-header-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* ─── Action Buttons ─────────────────────────────── */
.btn-act {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid #e5e9f0;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #6b7a99;
  cursor: pointer;
  transition: all .15s;
  padding: 0;
}

.btn-act:hover {
  background: #f0f2f5;
  border-color: #c8d0e0;
  color: #1c2333;
}

.btn-act.edit:hover {
  background: #f5f0e6;
  border-color: var(--brand);
  color: var(--brand);
}

.btn-act.del:hover {
  background: #fff1f3;
  border-color: #f43f5e;
  color: #f43f5e;
}

.btn-act.add:hover {
  background: #e6faf8;
  border-color: #0db9a0;
  color: #0db9a0;
}

/* ─── Sub-section List ───────────────────────────── */
.sub-list {
  padding: 8px 0;
}

.sub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-bottom: 1px solid #f5f6fa;
  cursor: pointer;
  transition: background .12s;
}

.sub-item:last-child {
  border-bottom: none;
}

.sub-item:hover {
  background: #f8f9fd;
}

.sub-toggle {
  font-size: 10px;
  color: #9ba8c0;
  transition: transform .2s;
  flex-shrink: 0;
  width: 14px;
}

.sub-toggle.open {
  transform: rotate(90deg);
  color: #4f6ef7;
}

.sub-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #f0f2f5;
  color: #6b7a99;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.sub-name {
  flex: 1;
  font-size: 14px;
  color: #344062;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Frequency Pill ─────────────────────────────── */
.freq-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  font-family: 'IBM Plex Mono', monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

.fp-hourly {
  background: #eef1fe;
  color: #4f6ef7;
}

.fp-daily {
  background: #e6faf8;
  color: #0db9a0;
}

.fp-2hourly {
  background: #fff3e8;
  color: #f97316;
}

.fp-twice {
  background: #f3efff;
  color: #8b5cf6;
}

.fp-none {
  background: #f0f2f5;
  color: #9ba8c0;
}

.sub-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: #9ba8c0;
  flex-shrink: 0;
  min-width: 38px;
  text-align: right;
}

.sub-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  opacity: 1;
  transition: opacity .15s;
}

.sub-item:hover .sub-actions {
  opacity: 1;
}

/* ─── Sub-sub-section ────────────────────────────── */
.subsub-list {
  display: none;
  background: #f8f9fd;
  border-top: 1px solid #f0f2f5;
}

.subsub-list.open {
  display: block;
}

.subsub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 8px 48px;
  border-bottom: 1px solid #f0f2f5;
  transition: background .12s;
}

.subsub-item:last-child {
  border-bottom: none;
}

.subsub-item:hover {
  background: #f0f2fa;
}

.subsub-connector {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  position: relative;
}

.subsub-connector::before {
  content: '';
  position: absolute;
  left: 6px;
  top: -4px;
  width: 1px;
  height: 12px;
  background: #c8d0e0;
}

.subsub-connector::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px;
  width: 8px;
  height: 1px;
  background: #c8d0e0;
}

.subsub-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #ede9fe;
  color: #8b5cf6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
}

.subsub-name {
  flex: 1;
  font-size: 12.5px;
  color: #4b5673;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Card Footer ────────────────────────────────── */
.card-footer-bar {
  padding: 10px 18px;
  background: #fafbfd;
  border-top: 1px solid #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-count {
  font-size: 11.5px;
  color: #9ba8c0;
}

.btn-add-sub {
  background: none;
  border: 1px dashed #c8d0e0;
  border-radius: 7px;
  padding: 5px 12px;
  font-size: 12px;
  font-family: inherit;
  color: #6b7a99;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all .15s;
}

.btn-add-sub:hover {
  border-color: #4f6ef7;
  color: #4f6ef7;
  background: #eef1fe;
}

.sub-item-actions {
  display: flex;
  gap: 6px;
  padding: 8px 0 10px;
  margin-left: 22px;
}

.subsub-item-actions {
  display: flex;
  gap: 6px;
  padding: 7px 0 9px;
}

.btn-row-action {
  flex: 1;
  display: inline-flex;
  height: 28px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid #e5e9f0;
  background: #fff;
  color: #6b7a99;
  font-size: 11.5px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.btn-row-action:hover {
  background: #f0f2f5;
  border-color: #c8d0e0;
  color: #1c2333;
}

.btn-add-log {
  background: #eef1fe;
  color: #4f6ef7;
  border-color: #d4dcfc;
}

/* ─── Empty State ────────────────────────────────── */
.empty-state {
  padding: 20px 18px;
  text-align: center;
  color: #9ba8c0;
  font-size: 13px;
}

.empty-state i {
  font-size: 24px;
  display: block;
  margin-bottom: 6px;
  opacity: .4;
}

/* ─── Dept Badge ─────────────────────────────────── */
.dept-badge {
  background: #f0f2f5;
  color: #6b7a99;
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}

@media (max-width: 576px) {
  .sections-grid {
    grid-template-columns: 1fr;
    padding: 0 12px 32px;
  }

  .toolbar {
    padding: 12px;
  }

  .page-header {
    padding: 14px 12px;
  }

  .stats-strip {
    padding: 0 12px;
  }
}