/* Global tokens and primitive definitions live in design-system.css. */

body {
  color: var(--ui-ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(37, 99, 235, .055), transparent 30rem),
    var(--ui-bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: 1320px;
  padding: 24px;
}

.top {
  margin-bottom: 16px;
}

.brand {
  color: #103a78;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.15;
}

.top .muted {
  margin-top: 3px;
  font-size: 13px;
}

.wrap > .tabs {
  gap: 6px;
  margin: 0 0 16px;
  padding: 6px;
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 3px 14px rgba(34, 55, 88, .045);
  backdrop-filter: blur(10px);
}

.wrap > .tabs button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #3e5068;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
}

.wrap > .tabs button:hover {
  border-color: #d6e3f5;
  background: #f3f7fd;
  color: #174d99;
}

.wrap > .tabs button.active {
  border-color: #1859c9;
  background: linear-gradient(135deg, #2169df, #1756c2);
  color: #fff;
  box-shadow: 0 5px 12px rgba(24, 89, 201, .22);
}

button,
.primary,
button.secondary {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }

.primary,
.tabs button.active {
  background: var(--ui-brand);
  color: #fff;
}

.primary:hover {
  background: var(--ui-brand-strong);
  box-shadow: 0 5px 12px rgba(24, 89, 201, .2);
}

button.secondary {
  border-color: #d5dfeb;
  background: #edf2f8;
  color: #334155;
}

button.secondary:hover {
  border-color: #c4d2e3;
  background: #e4ebf4;
}

.card,
.panel {
  border-color: var(--ui-line);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
}

.panel {
  padding: 20px;
}

.card {
  padding: 16px;
}

h1, h2, h3 {
  color: #17243a;
  letter-spacing: -.018em;
}

h2 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.25;
}

h3 {
  font-size: 17px;
  line-height: 1.35;
}

.muted {
  color: var(--ui-muted);
}

.grid {
  gap: 12px;
}

.kpi {
  position: relative;
  overflow: hidden;
  min-height: 92px;
  border-color: #d9e3f0;
  background: linear-gradient(145deg, #fff 50%, #f5f9ff);
}

.kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #4b82da;
}

.kpi .muted,
.kpi > span {
  font-size: 13px;
  font-weight: 550;
}

.kpi b {
  margin-top: 4px;
  color: #12233f;
  font-size: 27px;
  line-height: 1.1;
  letter-spacing: -.025em;
}

label {
  color: #435269;
  font-size: 13px;
  font-weight: 600;
}

input,
select,
textarea {
  min-height: 40px;
  border-color: var(--ui-line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ui-ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

textarea { min-height: 78px; }

input:hover,
select:hover,
textarea:hover {
  border-color: #9eb2cc;
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: #4c83dc;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .13);
}

.table-scroll {
  border: 1px solid var(--ui-line);
  border-radius: 11px;
  background: var(--ui-surface);
  scrollbar-color: #9eb1ca #edf2f7;
  scrollbar-width: thin;
}

.table-scroll table {
  margin: 0;
}

table {
  color: #243249;
}

th,
td {
  padding: 9px 10px;
  border-bottom-color: #e8edf4;
  font-size: 13.5px;
  line-height: 1.35;
}

th {
  height: 40px;
  background: #f5f8fc;
  color: #50627b;
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: .035em;
}

tbody tr:nth-child(even):not(.employee-group-row):not(.outlet-group-row):not(.schedule-group-row):not(.settings-group-row) td {
  background-color: #fbfcfe;
}

tbody tr:hover:not(.employee-group-row):not(.outlet-group-row):not(.schedule-group-row):not(.settings-group-row) td {
  background-color: #f1f6fd;
}

.table-scroll input,
.table-scroll select,
.table-scroll textarea {
  min-height: 36px;
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
}

.danger { background: #fff0f2; color: var(--ui-danger); }
.success { background: #eaf9f3; color: var(--ui-success); }
.badge.warning { background: #fff6e8; color: var(--ui-warning); }

.employee-toolbar {
  align-items: stretch;
}

.employee-toolbar .card {
  border-color: var(--ui-line);
  background: #fbfcfe;
}

.employee-toolbar h3 {
  margin-bottom: 14px;
}

.employee-group-row th,
.outlet-group-row th,
.schedule-group-row th,
.settings-group-row th {
  background: #e8f1ff;
  color: #174b91;
  border-top-color: #4d84d9;
  border-bottom-color: #bfd2ec;
}

.team-heading,
.photo-team-heading {
  background: linear-gradient(90deg, #edf4ff, #f9fbff);
}

.report-team,
.photo-team-section,
.visit-coordinator-group,
.issue-queue-card {
  border-color: var(--ui-line);
  box-shadow: 0 5px 18px rgba(30, 50, 80, .055);
}

.report-table thead th,
.visit-trace-table th,
.issue-queue-table th {
  background: #eaf1fa;
  color: #405775;
  border-bottom: 2px solid #9eb6d5;
}

.photo-report-table {
  border-color: #cbd7e6;
}

.photo-report-table th,
.photo-report-table td {
  border-color: #d6e0ec;
}

.photo-report-table thead tr:first-child th {
  background: #173f7a;
  color: #fff;
}

.photo-report-table thead tr:first-child th:first-child {
  background: #123663;
}

.photo-report-table thead tr:nth-child(2) th,
.photo-report-table thead tr:nth-child(3) th {
  background: #e9f1fb;
  color: #344b69;
}

.photo-team-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.photo-report-table {
  table-layout: fixed;
  min-width: 900px;
}
.photo-report-table th:first-child,
.photo-report-table td:first-child { width: 180px; }
.photo-report-table th:nth-child(2),
.photo-report-table td:nth-child(2) { width: 130px; }
.photo-report-table th:nth-child(3),
.photo-report-table th:nth-child(4),
.photo-report-table th:nth-child(5),
.photo-report-table th:nth-child(6),
.photo-report-table th:nth-child(7),
.photo-report-table th:nth-child(8),
.photo-report-table td:nth-child(3),
.photo-report-table td:nth-child(4),
.photo-report-table td:nth-child(5),
.photo-report-table td:nth-child(6),
.photo-report-table td:nth-child(7),
.photo-report-table td:nth-child(8) { width: 82px; text-align: center; }
.photo-report-table th:last-child,
.photo-report-table td:last-child { width: 150px; }
.photo-report-table .photo-time-input {
  width: 68px;
  min-width: 68px;
  margin: 0;
  padding: 7px 5px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.photo-report-table .photo-personnel {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.photo-report-table td:last-child input {
  min-width: 120px;
  margin: 0;
}

.live-dashboard-panel {
  margin-top: 14px;
}

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

.live-dashboard-head h2,
.live-dashboard-head p {
  margin-top: 0;
}

.live-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.live-dashboard-grid .card {
  min-width: 0;
  box-shadow: none;
}

.live-dashboard-grid h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 12px;
}


.server-resource-card { margin: 14px 0; background: linear-gradient(135deg, #ffffff 0%, #f4f8ff 100%); border: 1px solid #d7e5f7; }
.server-resource-head, .server-resource-foot, .resource-meter-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.server-resource-head h3 { margin: 0 0 3px; color: #123c7a; }
.server-resource-head p { margin: 0; font-size: 12px; }
.server-resource-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.resource-meter { min-width: 0; padding: 14px; border: 1px solid #dce7f4; border-radius: 12px; background: #fff; }
.resource-meter-top span { color: #52637a; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.resource-meter-top strong { color: #123c7a; font-size: 25px; }
.resource-track { height: 9px; margin: 12px 0 8px; overflow: hidden; border-radius: 999px; background: #e8eef7; }
.resource-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: #2d7ff9; transition: width .45s ease, background .25s ease; }
.resource-meter[data-level="medium"] .resource-track span { background: #e59a22; }
.resource-meter[data-level="high"] .resource-track span { background: #df5b4e; }
.resource-meter small { display: block; min-height: 30px; color: #64748b; font-size: 11px; line-height: 1.45; }
.resource-status { flex: 0 0 auto; padding: 5px 10px; border-radius: 999px; color: #166534; background: #dcfce7; font-size: 12px; font-weight: 700; }
.resource-status.medium { color: #92400e; background: #fef3c7; }
.resource-status.high { color: #991b1b; background: #fee2e2; }
.server-resource-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid #e2eaf4; font-size: 11px; }
@media (max-width: 800px) {
  .server-resource-card { margin: 10px 0; padding: 12px; }
  .server-resource-grid { grid-template-columns: 1fr; gap: 8px; }
  .resource-meter { padding: 12px; }
  .resource-meter strong { font-size: 22px; }
  .server-resource-head { align-items: flex-start; }
  .server-resource-head p { max-width: 190px; }
}

@media (max-width: 800px) {
  body { font-size: 14px; }

  .wrap { padding: 12px 10px 20px; }

  .top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px 12px;
    margin-bottom: 12px;
  }

  .top > div:first-child { min-width: 0; }
  .top > button { align-self: center; }
  .brand { font-size: 20px; }

  .wrap > .tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    padding: 5px;
    border-radius: 12px;
  }

  .wrap > .tabs button {
    min-height: 43px;
    padding: 7px 5px;
    font-size: 12.5px;
  }

  #app > .wrap > .grid,
  .live-dashboard-panel > .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .card,
  .panel {
    border-radius: 13px;
  }

  .panel { padding: 15px; }
  .card { padding: 13px; }

  h2 { font-size: 21px; }
  h3 { font-size: 16px; }

  .kpi {
    min-height: 80px;
    padding: 12px 12px 12px 14px;
  }

  .kpi .muted,
  .kpi > span { font-size: 12px; }
  .kpi b { font-size: 24px; }

  .live-dashboard-head {
    align-items: stretch;
    flex-direction: column;
  }

  .live-dashboard-head button { width: 100%; }

  .table-scroll {
    border-color: #dce5f0;
    box-shadow: inset -10px 0 12px -14px #314764;
  }

  .table-scroll::before {
    color: #5d6f86;
    background: #f5f8fc;
    font-weight: 600;
  }

  th,
  td {
    padding: 8px 7px;
    font-size: 13px;
  }

  th {
    font-size: 10.5px;
    letter-spacing: .025em;
  }

  .table-scroll th:first-child,
  .table-scroll td:first-child {
    border-right: 1px solid #dbe4ef;
    box-shadow: 5px 0 10px -9px #314764;
  }

  .table-scroll input,
  .table-scroll select,
  .table-scroll textarea {
    min-height: 38px;
    font-size: 16px;
  }

  .employee-toolbar { gap: 10px; }
  .employee-toolbar .card { background: #fff; }

  .report-head,
  .photo-report-head {
    gap: 12px;
  }

  .report-date-picker,
  .photo-report-controls {
    width: 100%;
  }

  .report-date-picker > *,
  .photo-report-controls > * {
    flex: 1 1 130px;
  }

  .report-date-picker input,
  .report-date-picker select,
  .photo-report-controls input,
  .photo-report-controls select {
    width: 100%;
    min-width: 0;
  }

  .report-summary { gap: 8px; }
  .report-team, .photo-team-section { padding: 12px; }

  .photo-team-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .photo-team-actions {
    width: 100%;
    justify-content: stretch;
  }
  .photo-team-actions button {
    flex: 1 1 160px;
  }
  .photo-report-table {
    min-width: 820px;
  }
  .photo-report-table th:first-child,
  .photo-report-table td:first-child { width: 155px; }
  .photo-report-table th:nth-child(2),
  .photo-report-table td:nth-child(2) { width: 105px; }
  .photo-report-table th:nth-child(n+3):nth-child(-n+8),
  .photo-report-table td:nth-child(n+3):nth-child(-n+8) { width: 72px; }
  .photo-report-table th:last-child,
  .photo-report-table td:last-child { width: 125px; }
}

@media (max-width: 390px) {
  .wrap > .tabs button { font-size: 12px; }
  #app > .wrap > .grid,
  .live-dashboard-panel > .grid { gap: 7px; }
  .kpi { min-height: 76px; }
}


.placement-guide-table tr.placement-row-main-off td {
  background: #fff8d6 !important;
  border-bottom-color: #facc15;
}
.placement-guide-table tr.placement-row-main-off td:first-child {
  border-left: 5px solid #d97706;
  color: #92400e;
  font-weight: 800;
}
.placement-guide-table tr.placement-row-main-off input,
.placement-guide-table tr.placement-row-main-off select {
  border-color: #eab308;
  background: #fffdf0;
}

.report-clear-team {
  white-space: nowrap;
}
@media (max-width: 800px) {
  .report-team .team-heading-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: stretch;
  }
  .report-team .team-heading-actions > button {
    flex: 1 1 180px;
  }
}
