:root {
  --bg-1: #2d2d2d;
  --bg-2: #262626;
  --surface: rgba(53, 53, 53, 0.9);
  --surface-2: rgba(60, 60, 60, 0.92);
  --line: #4a4a4a;
  --line-soft: #3b3b3b;
  --text: #f1f1f1;
  --muted: #b5b5b5;
  --brand: #a6a6a6;
  --green: #8d8d8d;
  --orange: #777777;
  --red: #636363;
  --violet: #4f4f4f;
  --kpi-value-size: 1.28rem;
  --chart-unit: clamp(250px, 34vh, 390px);
  --viz-card-h: clamp(300px, 38vh, 430px);
  --btn-bg: #3a3a3a;
  --btn-border: #5f5f5f;
  --btn-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg-1);
  overflow-x: hidden;
}

.app {
  max-width: 1600px;
  margin: 1.5rem auto 2.2rem;
  padding: 0 1rem;
}

.module-tabs {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
  align-items: center;
}

.sync-indicator {
  margin-left: auto;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid #575757;
  background: conic-gradient(#d6d6d6 calc(var(--sync-progress, 0) * 1turn), #454545 0);
  box-shadow: var(--btn-shadow);
  position: relative;
}

.sync-indicator::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  background: #2d2d2d;
  border: 1px solid #3b3b3b;
}

.tab-btn {
  height: 34px;
  padding: 0 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: #d8d8d8;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--btn-shadow);
}

.tab-btn.is-active {
  background: #5c5c5c;
  color: #fff;
  border-color: #7a7a7a;
}

.module-section[hidden] {
  display: none;
}

.topbar h1 {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: 0.3px;
}

.topbar p {
  margin: 0.3rem 0 1.2rem;
  color: var(--muted);
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  padding: 0.95rem;
  box-shadow: 0 8px 24px rgba(5, 9, 20, 0.35);
}

.time-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.95rem;
  box-shadow: 0 8px 24px rgba(5, 9, 20, 0.35);
  overflow: hidden;
}

.time-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.time-left,
.time-right {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.time-month-group {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.time-left label {
  display: inline-flex;
}

.time-left label input {
  height: 34px;
}

.time-status {
  font-size: 0.85rem;
  color: #cfcfcf;
  padding: 0 0.45rem;
  border-radius: 999px;
  border: 1px solid #4f4f4f;
  background: #343434;
  height: 34px;
  display: inline-flex;
  align-items: center;
}

.time-user-filter {
  display: inline-flex;
  align-items: center;
}

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

.time-calendar {
  margin-top: 0.8rem;
}

.time-left #timeStartBtn,
.time-left #timeStopBtn {
  height: 34px;
  padding: 0 0.9rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--btn-shadow);
}

.time-left #timeStartBtn {
  background: #2e6bff;
  border-color: #3b79ff;
  color: #fff;
}

.time-left #timeStopBtn {
  background: #c44a4a;
  border-color: #d45a5a;
  color: #fff;
}

.time-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #bdbdbd;
  margin-bottom: 0.35rem;
}

.time-user-label {
  color: #d8d8d8;
  font-weight: 700;
  font-size: 0.9rem;
}

.time-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 0.4rem;
}

.time-day {
  border: 1px solid #4e4e4e;
  border-radius: 10px;
  background: #343434;
  padding: 0.5rem 0.55rem;
  min-height: 80px;
  cursor: pointer;
  position: relative;
}

.time-day.is-vac-approved {
  border-color: rgba(104, 187, 124, 0.6);
  box-shadow: inset 0 0 0 1px rgba(104, 187, 124, 0.3);
}

.time-day.is-vac-pending {
  border-color: rgba(245, 180, 85, 0.7);
  box-shadow: inset 0 0 0 1px rgba(245, 180, 85, 0.35);
}

.time-day.is-disabled {
  cursor: default;
  opacity: 0.7;
}

.time-day.is-empty {
  background: transparent;
  border: 1px dashed #3d3d3d;
  cursor: default;
}

.time-day .day-num {
  font-size: 0.8rem;
  color: #cfcfcf;
}

.time-day .day-hours {
  margin-top: 0.4rem;
  font-weight: 800;
  color: #f0f0f0;
}

.time-day .day-vac {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #ffd08a;
}

.day-vac-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  margin-left: 0.35rem;
  background: rgba(60, 60, 60, 0.7);
  border: 1px solid #4a4a4a;
  color: #fff;
}

.day-vac-icon.is-float {
  position: absolute;
  top: 6px;
  right: 6px;
  margin: 0;
}

.day-vac-icon.is-approved {
  color: #b8f2c4;
  border-color: rgba(104, 187, 124, 0.6);
}

.day-vac-icon.is-pending {
  color: #ffd08a;
  border-color: rgba(245, 180, 85, 0.7);
}

.time-lists {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.time-lists::-webkit-scrollbar {
  display: none;
}

.time-list {
  width: 100%;
}

.time-list .admin-list-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overflow: hidden;
}

.time-list .admin-list-wrap::-webkit-scrollbar {
  display: none;
}

.time-list .admin-table {
  width: 100%;
  min-width: 920px;
}

.time-list .table-content {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
}

.time-list .table-content::-webkit-scrollbar {
  display: none;
}

.time-list .admin-list-wrap > table {
  width: max-content;
}

.time-weekly {
  margin-top: 1rem;
}

.time-weekly h3 {
  margin: 0 0 0.45rem;
}

.time-list h3 {
  margin: 0 0 0.45rem;
}

.time-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  height: 40px;
  padding: 0 0.75rem;
  border-radius: 10px;
  border: 1px solid #4a4a4a;
  background: #343434;
  color: #e9e9e9;
  font-weight: 700;
  cursor: pointer;
}

.time-toggle .toggle-icon {
  font-size: 0.9rem;
}

.time-collapsible {
  margin-top: 0.55rem;
}

#adminSyncStatus {
  white-space: pre-line;
}

#shopifySyncStatus {
  white-space: pre-line;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}

.modal.is-open {
  display: block;
}

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

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.modal-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(1600px, calc(100% - 2rem));
  max-height: 80vh;
  background: linear-gradient(145deg, rgba(60, 60, 60, 0.98), rgba(46, 46, 46, 0.98));
  border: 1px solid #5b5b5b;
  border-radius: 14px;
  padding: 0.9rem;
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}


@media print {
  @page {
    size: auto;
    margin: 12mm;
  }
  body * {
    visibility: hidden;
  }
  #genericModal,
  #genericModal * {
    visibility: visible;
  }
  body {
    background: #fff;
  }
  #genericModal {
    position: static;
    inset: auto;
    z-index: auto;
    padding: 0;
  }
  #genericModal .modal-backdrop,
  #genericModalCloseBtn,
  #genericModalPrintBtn,
  #unfulfilledCsvBtn {
    display: none !important;
  }
  #genericModal .modal-panel {
    position: static;
    transform: none;
    width: 100%;
    max-height: none;
    box-shadow: none;
    border: none;
    background: #fff;
    color: #111;
    padding: 0;
  }
  #genericModal .modal-body table {
    min-width: 0;
  }
  #genericModal .modal-body th,
  #genericModal .modal-body td {
    color: #111;
    border-color: #ddd;
  }
}

.time-entry-form {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.6rem;
}

.tiny-btn {
  height: 28px;
  padding: 0 0.6rem;
  border-radius: 8px;
  border: 1px solid #5b5b5b;
  background: #3a3a3a;
  color: #ededed;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.tiny-btn + .tiny-btn {
  margin-left: 0.35rem;
}

.tiny-btn.danger {
  border-color: var(--btn-border);
  background: var(--btn-bg);
  color: #fff;
}

@media (max-width: 980px) {
  .time-lists {
    grid-template-columns: 1fr;
  }
  .time-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 760px) {
  .time-head {
    align-items: stretch;
  }
  .time-left,
  .time-right {
    flex-wrap: wrap;
    width: 100%;
  }
  .time-left {
    flex-wrap: wrap;
  }
  .time-left label,
  .time-right label,
  .time-right .time-user-label,
  .time-right #vacationRequestBtn,
  #timeUserWrap,
  #timeUserWrap select,
  .time-left #timeStartBtn,
  .time-left #timeStopBtn,
  .time-left #timeReloadBtn,
  .time-left .time-status {
    width: 100%;
  }
  .time-month-group {
    width: 100%;
  }
  .time-month-group #timePrevMonthBtn,
  .time-month-group #timeNextMonthBtn {
    width: 44px;
    flex: 0 0 auto;
  }
  .time-month-group label {
    flex: 1 1 auto;
  }
  .time-month-group label input {
    width: 100%;
  }
  .time-left #timePrevMonthBtn,
  .time-left #timeNextMonthBtn {
    width: 44px;
    flex: 0 0 auto;
  }
  .time-left label,
  .time-left label input,
  .time-left #timeReloadBtn,
  .time-left #timeStartBtn,
  .time-left #timeStopBtn,
  .time-right #vacationRequestBtn {
    height: 40px;
  }
  .time-left label {
    flex: 1 1 auto;
  }
  .time-left label input {
    width: 100%;
  }
  .time-left {
    flex-direction: row;
  }
  .time-status {
    justify-content: center;
  }
  .time-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
  .time-day {
    min-height: 90px;
  }
  .time-weekdays {
    grid-template-columns: repeat(2, 1fr);
  }
  .time-weekdays span:nth-child(n+3) {
    display: none;
  }
  .time-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .time-entry-form {
    grid-template-columns: 1fr;
  }
  .admin-list-wrap {
    overflow-x: auto;
  }
  .admin-table {
    min-width: 560px;
  }
}

.filters-main {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  align-items: end;
}

.filters-actions {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.preset-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding: 0.7rem 0 0.15rem;
  border-top: 1px solid #474747;
}

.preset-btn {
  height: 32px;
  border: 1px solid #5f5f5f;
  border-radius: 999px;
  background: #3a3a3a;
  color: #d8d8d8;
  padding: 0 0.72rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--btn-shadow);
}

.preset-btn:hover {
  background: #454545;
}

.preset-btn.is-active {
  background: #6b6b6b;
  color: #ffffff;
  border-color: #808080;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  font-size: 0.84rem;
  color: var(--muted);
}

input, select, button {
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--line);
  padding: 0 0.65rem;
  background: #3a3a3a;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  background-clip: padding-box;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  outline: none;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 4px;
  background: transparent;
  border: 1px solid var(--line);
  appearance: auto;
  -webkit-appearance: auto;
  vertical-align: middle;
}

select {
  padding-right: 1.7rem;
  background-image:
    linear-gradient(45deg, transparent 50%, #cfcfcf 50%),
    linear-gradient(135deg, #cfcfcf 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

input:focus,
select:focus,
button:focus,
input:focus-visible,
select:focus-visible,
button:focus-visible {
  border-color: #6e6e6e;
  box-shadow: none;
}

input:hover,
select:hover {
  border-color: #6e6e6e;
}

button {
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--btn-shadow);
}

button:hover {
  background: #454545;
}

.logout-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 0.78rem;
  border-radius: 9px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: #efefef;
  text-decoration: none;
  font-weight: 700;
  box-shadow: var(--btn-shadow);
}

.logout-link:hover {
  background: #454545;
}

.admin-gear {
  width: 38px;
  min-width: 38px;
  padding: 0;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  font-size: 1rem;
  box-shadow: var(--btn-shadow);
}

.admin-gear:hover {
  background: #454545;
}

.cards {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 0.7rem;
}

.card {
  background: linear-gradient(145deg, rgba(62, 62, 62, 0.92), rgba(48, 48, 48, 0.95));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.78rem;
  box-shadow: 0 10px 25px rgba(7, 10, 24, 0.35);
}

.card .label {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.2px;
}

.card .value {
  margin-top: 0.3rem;
  font-weight: 800;
  font-size: var(--kpi-value-size);
  line-height: 1.15;
}

.analytics-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  grid-auto-flow: row;
  grid-auto-rows: var(--viz-card-h);
  align-items: stretch;
}

.viz-card {
  background: linear-gradient(145deg, rgba(60, 60, 60, 0.95), rgba(46, 46, 46, 0.95));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.88rem;
  box-shadow: 0 14px 30px rgba(6, 10, 22, 0.4);
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viz-card h2 {
  margin: 0 0 0.7rem;
  font-size: 0.96rem;
  color: #f0f0f0;
  letter-spacing: 0.2px;
}

.unfulfilled-detail {
  margin-top: 0.6rem;
  max-height: 220px;
  overflow: auto;
  border: 1px solid #4e4e4e;
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  background: rgba(40, 40, 40, 0.88);
}

.unfulfilled-detail .hint {
  font-size: 0.78rem;
}

.unfulfilled-detail table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
}

.unfulfilled-detail th,
.unfulfilled-detail td {
  border-bottom: 1px solid #525252;
  padding: 0.35rem 0.4rem;
  font-size: 0.78rem;
  text-align: left;
}

.unfulfilled-detail th {
  color: #c8c8c8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-size: 0.7rem;
}

.modal-body {
  margin-top: 0.6rem;
  max-height: calc(80vh - 70px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #5a5a5a transparent;
}

.modal-body::-webkit-scrollbar {
  width: 10px;
}
.modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.modal-body::-webkit-scrollbar-thumb {
  background: #5a5a5a;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.modal-search {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.2rem 0 0.6rem;
}

.modal-search input {
  width: 100%;
}

.modal-body table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.modal-body th,
.modal-body td {
  border-bottom: 1px solid #4f4f4f;
  padding: 0.45rem 0.5rem;
  font-size: 0.8rem;
  text-align: left;
}

.modal-body td.num,
.modal-body th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.modal-body th {
  color: #c8c8c8;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-size: 0.7rem;
}

#unfulfilledDayCanvas,
#unfulfilledTopCanvas {
  width: 100%;
  height: 100% !important;
  display: block !important;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(50, 50, 50, 0.92), rgba(40, 40, 40, 0.96));
  border: 1px solid var(--line-soft);
}

.chart-shell {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

.hint {
  color: var(--muted);
  margin: 0;
}

#trendCanvas,
#marketingMixCanvas,
#revenueBarsCanvas,
#opsBarsCanvas {
  width: 100%;
  height: 100% !important;
  display: block !important;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(50, 50, 50, 0.92), rgba(40, 40, 40, 0.96));
  border: 1px solid var(--line-soft);
}

.table-wrap {
  margin-top: 1rem;
  background: linear-gradient(145deg, rgba(58, 58, 58, 0.95), rgba(45, 45, 45, 0.95));
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 14px 30px rgba(7, 10, 22, 0.4);
}

.table-toolbar {
  display: block;
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid #4f4f4f;
}

.table-summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid #5a5a5a;
  background: #3b3b3b;
  color: #efefef;
  padding: 0.45rem 0.65rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
  user-select: none;
}

.table-summary:hover {
  background: #464646;
}

.summary-main {
  font-size: 0.86rem;
  color: #f0f0f0;
}

.summary-meta {
  font-size: 0.82rem;
  color: #cfcfcf;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-arrow {
  font-size: 0.9rem;
  color: #f0f0f0;
}

.table-content {
  overflow: auto;
}

.table-wrap.is-collapsed .table-toolbar {
  border-bottom: none;
}

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

th, td {
  border-bottom: 1px solid #515151;
  text-align: right;
  padding: 0.55rem;
  font-size: 0.84rem;
  color: #ececec;
}

thead th {
  color: #bdbdbd;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: rgba(52, 52, 52, 0.92);
  position: sticky;
  top: 0;
}

th:first-child, td:first-child {
  text-align: left;
}

.expand-cell {
  width: 28px;
  text-align: center !important;
}

.expand-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid #5b5b5b;
  background: #3a3a3a;
  color: #e5e5e5;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.table-wrap tbody tr {
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.table-wrap tbody tr:hover {
  background: rgba(255, 255, 255, 0.06);
}

.table-wrap tbody tr.row-active {
  background: rgba(255, 255, 255, 0.11);
}

.detail-row td {
  background: rgba(42, 42, 42, 0.95);
  border-bottom: 1px solid #5a5a5a;
}

.inline-detail-wrap {
  padding: 0.4rem 0.1rem;
  animation: detailFade 0.18s ease-out;
}

.inline-detail-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
  color: #efefef;
}

.inline-detail-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.inline-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.45rem;
}

.inline-detail-grid div,
.inline-channel-list div {
  border: 1px solid #5a5a5a;
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  background: rgba(56, 56, 56, 0.9);
}

.inline-detail-grid span,
.inline-channel-list span {
  display: block;
  font-size: 0.74rem;
  color: #b7b7b7;
  margin-bottom: 0.2rem;
}

.inline-channel-list {
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0.45rem;
}

.inline-drill {
  margin-top: 0.6rem;
}

.drilldown-table-wrap {
  overflow: auto;
  border: 1px solid #5a5a5a;
  border-radius: 9px;
  background: rgba(44, 44, 44, 0.95);
}

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

.drilldown-table th,
.drilldown-table td {
  border-bottom: 1px solid #555555;
  padding: 0.45rem 0.5rem;
  font-size: 0.78rem;
  text-align: left;
  vertical-align: top;
  color: #ececec;
}

.drilldown-table td.money,
.drilldown-table td.num,
.drilldown-table th.money,
.drilldown-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.drilldown-table th {
  color: #c5c5c5;
  background: rgba(62, 62, 62, 0.92);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-size: 0.7rem;
}

.month-summary-row td {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  border-bottom: 1px solid #6a6a6a;
}

.month-summary-row .summary-label {
  color: #d8d8d8;
}

.drilldown-table td:nth-child(7),
.drilldown-table td:nth-child(8),
.drilldown-table td:nth-child(9),
.drilldown-table th:nth-child(7),
.drilldown-table th:nth-child(8),
.drilldown-table th:nth-child(9) {
  text-align: right;
}

.breakdown-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.7rem;
}

.mini-card {
  border: 1px solid #5a5a5a;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  background: rgba(56, 56, 56, 0.9);
}

.mini-card .label {
  color: #bdbdbd;
  font-size: 0.77rem;
}

.mini-card .value {
  margin-top: 0.2rem;
  font-weight: 800;
  font-size: var(--kpi-value-size);
  line-height: 1.15;
}

.channel-bars {
  display: grid;
  gap: 0.45rem;
}

.day-breakdown-content {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  overflow: auto;
  min-height: 0;
}

.channel-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.84rem;
}

.channel-track {
  height: 10px;
  background: #404040;
  border-radius: 999px;
  overflow: hidden;
}

.channel-fill { height: 100%; }
.fill-facebook { background: #36a2eb; }
.fill-google { background: #ff6384; }
.fill-tiktok { background: #ffce56; }
.fill-pinterest { background: #4bc0c0; }

.mix-stats {
  margin-top: 0.55rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.mix-row {
  border: 1px solid #5a5a5a;
  border-radius: 8px;
  padding: 0.38rem 0.5rem;
  background: rgba(56, 56, 56, 0.9);
}

.mix-row .name {
  font-size: 0.72rem;
  color: #bdbdbd;
}

.mix-row .vals {
  margin-top: 0.15rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.mix-row .abs {
  color: #f0f0f0;
  font-weight: 700;
  font-size: 0.8rem;
}

.mix-row .pct {
  color: #c2c2c2;
  font-size: 0.72rem;
}

@keyframes detailFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1024px) {
  .analytics-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .app {
    margin: 1rem auto 1.5rem;
  }
  .analytics-grid,
  .cards {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
  .viz-card { min-height: 480px; }
  .chart-shell { height: 380px; min-height: 380px; }
  .inline-channel-list {
    grid-template-columns: 1fr 1fr;
  }
  .channel-row {
    grid-template-columns: 76px 1fr auto;
  }
  .filters-actions {
    margin-left: 0;
  }
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-card {
  width: min(420px, 100%);
  background: linear-gradient(145deg, rgba(60, 60, 60, 0.95), rgba(46, 46, 46, 0.95));
  border: 1px solid #5a5a5a;
  border-radius: 16px;
  padding: 1.2rem;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
}

.login-card h1 {
  margin: 0;
  font-size: 1.25rem;
}

.login-card p {
  margin: 0.4rem 0 1rem;
  color: #b8b8b8;
}

.login-form {
  display: grid;
  gap: 0.75rem;
}

.login-form label {
  font-size: 0.83rem;
  color: #bdbdbd;
}

.login-form input {
  margin-top: 0.28rem;
}

.login-error {
  border: 1px solid #9e5252;
  background: rgba(143, 49, 49, 0.3);
  color: #ffd9d9;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  font-size: 0.84rem;
  margin-bottom: 0.75rem;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.admin-panel {
  position: absolute;
  right: 1rem;
  top: 1rem;
  width: min(1600px, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  overflow: auto;
  background: linear-gradient(145deg, rgba(60, 60, 60, 0.98), rgba(46, 46, 46, 0.98));
  border: 1px solid #5b5b5b;
  border-radius: 14px;
  padding: 0.9rem;
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.45);
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.admin-head h2 {
  margin: 0;
  font-size: 1rem;
}

.admin-close {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #5b5b5b;
  border-radius: 8px;
  background: #3c3c3c;
  color: #f0f0f0;
  cursor: pointer;
}

.admin-create {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 0.6rem;
  align-items: end;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
}

.admin-list-wrap {
  margin-top: 0.8rem;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid #555;
  border-radius: 10px;
  width: 100%;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: relative;
  display: block;
  touch-action: pan-x;
}

.admin-list-wrap::-webkit-scrollbar {
  display: none;
}

.admin-list-actions {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid #505050;
  background: rgba(52, 52, 52, 0.6);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
  max-width: none;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid #505050;
  padding: 0.6rem 0.6rem;
  font-size: 0.78rem;
  text-align: left;
}

.pw-update {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pw-update .admin-pw-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #5b5b5b;
  border-radius: 8px;
  background: #3c3c3c;
  color: #d8d8d8;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
}

.admin-table th {
  color: #c5c5c5;
  background: rgba(62, 62, 62, 0.92);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-size: 0.7rem;
}

.admin-table th.col-pw {
  width: 160px;
}

.admin-table input[type="password"] {
  height: 34px;
  line-height: 34px;
  min-width: 120px;
}

.admin-table tr.is-saving {
  opacity: 0.75;
}

.admin-table input[type="checkbox"] {
  accent-color: #d0d0d0;
}

.admin-divider {
  border: none;
  border-top: 1px solid #555;
  margin: 1rem 0 0.7rem;
}

.admin-subtitle {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.admin-sync-row {
  display: flex;
  align-items: flex-end;
  gap: 0.7rem;
  margin: 0.4rem 0 0.7rem;
  flex-wrap: wrap;
}

.admin-log {
  margin-top: 1rem;
}

.admin-log-box {
  border: 1px solid #505050;
  border-radius: 12px;
  background: #262626;
  padding: 0.65rem 0.8rem;
  min-height: 120px;
  max-height: 240px;
  overflow: auto;
  font-size: 0.85rem;
  line-height: 1.35;
  color: #d7d7d7;
  white-space: pre-line;
}

.admin-log-line {
  padding: 2px 0;
}

.admin-log-ok {
  color: #85e0a3;
}

.admin-log-error {
  color: #ff9b9b;
}

.shopify-oauth-row {
  margin: 0 0 0.5rem;
}

.shopify-oauth-row button {
  height: 38px;
}

#shopifyOauthStatus {
  margin: 0.2rem 0 0.6rem;
  min-height: 1.1rem;
}

#adminSyncStatus {
  margin: 0.45rem 0 0.35rem;
  min-height: 1.1rem;
}

#adminConnStatus {
  margin: 0.1rem 0 0.6rem;
  min-height: 1.1rem;
}

.oauth-connect-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 0.6rem;
  margin: 0 0 0.7rem;
  align-items: end;
}

.oauth-shop-select {
  grid-column: span 1;
}

.oauth-connect-btn {
  height: 38px;
  border: 1px solid var(--btn-border);
  border-radius: 9px;
  background: var(--btn-bg);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.oauth-connect-btn:hover {
  background: #454545;
}

.admin-save-btn {
  height: 30px;
  border: 1px solid var(--btn-border);
  border-radius: 7px;
  background: var(--btn-bg);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  padding: 0 0.6rem;
  box-shadow: var(--btn-shadow);
}

.admin-oauth-btn {
  height: 30px;
  border: 1px solid var(--btn-border);
  border-radius: 7px;
  background: var(--btn-bg);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  padding: 0 0.6rem;
  box-shadow: var(--btn-shadow);
}

.admin-oauth-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.conn-discover-btn {
  margin-top: 0.3rem;
  height: 26px;
  border: 1px solid var(--btn-border);
  border-radius: 7px;
  background: var(--btn-bg);
  color: #f0f0f0;
  cursor: pointer;
  font-size: 0.72rem;
  padding: 0 0.5rem;
  box-shadow: var(--btn-shadow);
}

.picker-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
}

.picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.picker-panel {
  position: absolute;
  right: 1.1rem;
  top: 1.1rem;
  width: min(460px, calc(100% - 2.2rem));
  background: linear-gradient(145deg, rgba(60, 60, 60, 0.98), rgba(46, 46, 46, 0.98));
  border: 1px solid #5b5b5b;
  border-radius: 12px;
  padding: 0.8rem;
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.45);
}

.picker-panel h3 {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
}

.picker-panel select {
  margin-top: 0.25rem;
}

.picker-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.7rem;
}

.picker-actions button {
  height: 34px;
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  background: var(--btn-bg);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  padding: 0 0.7rem;
  box-shadow: var(--btn-shadow);
}

@media (max-width: 900px) {
  .admin-create {
    grid-template-columns: 1fr 1fr;
  }

  .oauth-connect-grid {
    grid-template-columns: 1fr 1fr;
  }

  .oauth-shop-select {
    grid-column: 1 / -1;
  }
}
.money, .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

th.money, th.num {
  text-align: right;
}
.time-delete {
  min-width: 34px;
  height: 32px;
  padding: 0 0.5rem;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: #fff;
  box-shadow: var(--btn-shadow);
}

.time-delete:hover {
  background: #454545;
}
