* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.5;
}

header {
  background: #1a1a2e;
  color: #fff;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  font-size: 1.4rem;
  font-weight: 600;
}

.status {
  font-size: 0.85rem;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
}

.status.healthy {
  background: #2ecc71;
  color: #fff;
}

.status.degraded {
  background: #e67e22;
  color: #fff;
}

.status.error {
  background: #e74c3c;
  color: #fff;
}

main {
  margin: 2rem auto;
  padding: 0 1rem;
}

.filters {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filters label {
  font-size: 0.9rem;
}

.filters input[type="date"] {
  padding: 0.3rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.filters button {
  padding: 0.4rem 1rem;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.filters button:hover {
  background: #16213e;
}

h2 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

thead {
  background: #1a1a2e;
  color: #fff;
}

th, td {
  padding: 0.6rem 1rem;
  text-align: left;
}

tbody tr:nth-child(even) {
  background: #f9f9f9;
}

tbody tr:hover {
  background: #eef;
}

.empty {
  text-align: center;
  padding: 2rem;
  color: #999;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  background: #ddd;
  margin-right: 0.3rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #1a1a2e;
}

.tab {
  padding: 0.6rem 1.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  color: #666;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab.active {
  color: #1a1a2e;
  border-bottom-color: #1a1a2e;
  font-weight: 600;
}

.tab:hover {
  color: #333;
}

.tab-content {
  display: block;
}

.tab-content[hidden] {
  display: none;
}

/* Batch actions */
.batch-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.5rem 1rem;
  background: #e8f4fd;
  border-radius: 4px;
}

.btn-approve {
  background: #2ecc71;
  color: #fff;
  border: none;
  padding: 0.3rem 1rem;
  border-radius: 4px;
  cursor: pointer;
}

.btn-reject {
  background: #e74c3c;
  color: #fff;
  border: none;
  padding: 0.3rem 1rem;
  border-radius: 4px;
  cursor: pointer;
}

.btn-approve:hover { background: #27ae60; }
.btn-reject:hover { background: #c0392b; }

/* Confidence indicator */
.confidence {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 600;
}

.confidence.high { background: #d5f5e3; color: #1e8449; }
.confidence.medium { background: #fdebd0; color: #b9770e; }
.confidence.low { background: #fadbd8; color: #c0392b; }

/* Status badge */
.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.pending { background: #fdebd0; color: #b9770e; }
.status-badge.approved { background: #d5f5e3; color: #1e8449; }
.status-badge.rejected { background: #fadbd8; color: #c0392b; }
.status-badge.modified { background: #d6eaf8; color: #2471a3; }
.status-badge.synced { background: #a9dfbf; color: #145a32; }

/* Select */
select {
  padding: 0.3rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
}

/* Action buttons in table */
.action-btn {
  padding: 0.2rem 0.6rem;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.8rem;
  margin-right: 0.3rem;
}

.btn-sync {
  background: #3498db;
  color: #fff;
  border: none;
  padding: 0.3rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}

.btn-sync:hover { background: #2980b9; }
.btn-sync:disabled { background: #bdc3c7; cursor: not-allowed; }

/* DevOps tab */
.devops-section {
  background: #fff;
  border-radius: 6px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.devops-section h3 {
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.devops-section h4 {
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
}

.lock-status {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-weight: 600;
}

.lock-status.unlocked {
  background: #d5f5e3;
  color: #1e8449;
}

.lock-status.locked {
  background: #fadbd8;
  color: #c0392b;
}

.devops-section input[type="password"],
.devops-section input[type="text"] {
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-right: 0.5rem;
  font-size: 0.9rem;
}

.devops-section button {
  padding: 0.4rem 1rem;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}

.devops-section button:hover {
  background: #16213e;
}

.token-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.scope-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
}

.scope-badge.read { background: #d6eaf8; color: #2471a3; }
.scope-badge.write { background: #fdebd0; color: #b9770e; }

/* Extractor tab */
.extractor-section {
  max-width: 800px;
}

.extractor-section h3 {
  margin: 1.5rem 0 0.5rem;
  color: #1a1a2e;
}

.extractor-section h3:first-child {
  margin-top: 0;
}

.extractor-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.2rem 1.5rem;
  margin-bottom: 1rem;
}

.extractor-card h4 {
  margin: 0 0 0.5rem;
  color: #1a1a2e;
}

.extractor-desc {
  color: #555;
  font-size: 0.9rem;
  margin: 0.3rem 0;
}

.extractor-card ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  color: #555;
  font-size: 0.9rem;
}

.extractor-card ul li {
  margin-bottom: 0.3rem;
}

.btn-download {
  display: inline-block;
  margin-top: 0.8rem;
  padding: 0.6rem 1.5rem;
  background: #0078d4;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
}

.btn-download:hover {
  background: #106ebe;
}

.code-block {
  background: #1a1a2e;
  color: #e0e0e0;
  padding: 0.8rem 1rem;
  border-radius: 4px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.85rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}

.btn-small {
  padding: 0.3rem 0.8rem;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

.btn-small:hover {
  background: #16213e;
}

/* Comparison tab */
.comparison-period {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: #1a1a2e;
}

.comparison-totals {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.total-card {
  background: #fff;
  border-radius: 6px;
  padding: 1rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  min-width: 140px;
  text-align: center;
}

.total-card .label {
  font-size: 0.8rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.total-card .value {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 0.3rem;
}

.total-card .value.ok { color: #1e8449; }
.total-card .value.warning { color: #b9770e; }
.total-card .value.error { color: #c0392b; }

.delta-ok { color: #1e8449; }
.delta-warning { color: #b9770e; }
.delta-error { color: #c0392b; }

.section-title {
  margin: 1.5rem 0 0.8rem;
  font-size: 1rem;
  color: #555;
}

.day-card {
  background: #fff;
  border-radius: 6px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.day-card.absence {
  background: #fef9e7;
  border-left: 3px solid #f39c12;
}

.day-card .day-label {
  font-weight: 600;
  min-width: 120px;
  color: #1a1a2e;
}

.day-card .day-clients {
  flex: 1;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.day-client-chip {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  font-size: 0.8rem;
  background: #eef;
  color: #333;
}

tfoot td {
  font-weight: 700;
  border-top: 2px solid #1a1a2e;
}

/* ===== Agenda (Outlook-style calendar) ===== */

.agenda-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 8px 0;
}

.agenda-toolbar .btn-nav {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid #d0d0d0;
  background: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
}

.agenda-toolbar .btn-nav:hover {
  background: #f0f0f0;
}

.agenda-toolbar .btn-today {
  padding: 4px 14px;
  border-radius: 4px;
  border: 1px solid #0078d4;
  background: #fff;
  color: #0078d4;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.agenda-toolbar .btn-today:hover {
  background: #e8f2fc;
}

.agenda-period-label {
  font-size: 1rem;
  font-weight: 600;
  color: #242424;
  margin-left: 0.5rem;
}

/* All-day events */
.agenda-allday {
  display: flex;
  border: 1px solid #e0e0e0;
  border-bottom: none;
  background: #fafafa;
  overflow: hidden;
  min-height: 30px;
}

.agenda-allday-label {
  width: 52px;
  min-width: 52px;
  font-size: 0.65rem;
  color: #888;
  padding: 4px 4px;
  text-align: right;
  border-right: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.agenda-allday-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
}

.agenda-allday-cell {
  border-right: 1px solid #ededed;
  padding: 2px 3px;
  min-height: 26px;
}

.agenda-allday-cell:last-child {
  border-right: none;
}

.agenda-allday-event {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 3px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}

/* Calendar grid wrapper */
.agenda-wrapper {
  border: 1px solid #e0e0e0;
  overflow-y: auto;
  max-height: calc(100vh - 200px);
  background: #fff;
}

.agenda-grid {
  display: grid;
  grid-template-columns: 52px repeat(5, 1fr);
  position: relative;
  min-height: 0;
}

/* Time gutter */
.agenda-gutter {
  position: relative;
  border-right: 1px solid #e0e0e0;
}

.agenda-time-label {
  position: absolute;
  right: 6px;
  font-size: 0.68rem;
  color: #999;
  transform: translateY(-50%);
  user-select: none;
  font-family: 'Segoe UI', sans-serif;
}

/* Day columns */
.agenda-day-col {
  position: relative;
  border-left: 1px solid #ededed;
}

.agenda-day-col.today {
  background: #f5f9ff;
}

/* Day header */
.agenda-day-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 4px 8px;
  text-align: center;
  font-size: 0.78rem;
  color: #616161;
}

.agenda-day-header .day-name {
  text-transform: capitalize;
  font-weight: 400;
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.3px;
}

.agenda-day-header .day-number {
  display: inline-block;
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 1px;
  color: #333;
}

.agenda-day-header.today {
  color: #0078d4;
}

.agenda-day-header.today .day-number {
  background: #0078d4;
  color: #fff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  line-height: 32px;
  text-align: center;
}

.agenda-day-header.today .day-name {
  color: #0078d4;
  font-weight: 600;
}

/* Gutter header (empty top-left corner) */
.agenda-gutter-header {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  height: 52px;
}

/* Time slot lines */
.agenda-slot-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid #ededed;
}

.agenda-slot-line.half {
  border-top: 1px dashed #f5f5f5;
}

/* Current time indicator */
.agenda-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #d63031;
  z-index: 2;
}

.agenda-now-line::before {
  content: '';
  position: absolute;
  left: -5px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d63031;
}

/* Event blocks */
.agenda-event {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.72rem;
  line-height: 1.25;
  overflow: hidden;
  cursor: default;
  z-index: 1;
  border-left: 4px solid;
  transition: filter 0.15s;
}

.agenda-event:hover {
  filter: brightness(0.93);
  z-index: 5;
}

.agenda-event .ev-time {
  font-size: 0.65rem;
  opacity: 0.85;
}

.agenda-event .ev-subject {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.73rem;
}

.agenda-event .ev-organizer {
  font-size: 0.65rem;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-event .ev-location {
  font-size: 0.63rem;
  opacity: 0.65;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-event .ev-details {
  font-size: 0.63rem;
  opacity: 0.65;
  margin-top: 1px;
}

.agenda-event .ev-icons {
  position: absolute;
  right: 4px;
  top: 2px;
  font-size: 0.6rem;
  opacity: 0.6;
}

/* Client color scheme — Outlook-accurate */
.agenda-event.client-vcgp {
  background: #d3e5ef;
  border-left-color: #0078d4;
  color: #1b3a4b;
}

.agenda-event.client-mpp {
  background: #dff6dd;
  border-left-color: #107c10;
  color: #0b3d0b;
}

.agenda-event.client-jtekt {
  background: #fff4ce;
  border-left-color: #c19c00;
  color: #5c4b00;
}

.agenda-event.client-efi {
  background: #e8daef;
  border-left-color: #8764b8;
  color: #3b1f5e;
}

.agenda-event.client-interne {
  background: #fce4ec;
  border-left-color: #e81123;
  color: #6d0519;
}

.agenda-event.client-unknown {
  background: #f0f0f0;
  border-left-color: #8a8886;
  color: #323130;
}

/* Show-as indicators */
.agenda-event.show-oof {
  background: #fce4ec !important;
  border-left-color: #c62828 !important;
  color: #7f1d1d !important;
}

.agenda-event.show-tentative {
  border-left-style: dashed;
}

.agenda-event.show-free {
  opacity: 0.5;
  border-left-style: dotted;
}

/* Cancelled */
.agenda-event.cancelled {
  opacity: 0.4;
  text-decoration: line-through;
}

/* Overlapping events */
.agenda-event.overlap-2 { right: 50%; }
.agenda-event.overlap-2.overlap-idx-1 { left: calc(50% + 1px); right: 2px; }
.agenda-event.overlap-3 { right: 66.66%; }
.agenda-event.overlap-3.overlap-idx-1 { left: calc(33.33% + 1px); right: calc(33.33% + 1px); }
.agenda-event.overlap-3.overlap-idx-2 { left: calc(66.66% + 1px); right: 2px; }
.agenda-event.overlap-4 { right: 75%; }
.agenda-event.overlap-4.overlap-idx-1 { left: calc(25% + 1px); right: 50%; }
.agenda-event.overlap-4.overlap-idx-2 { left: calc(50% + 1px); right: 25%; }
.agenda-event.overlap-4.overlap-idx-3 { left: calc(75% + 1px); right: 2px; }

/* Tooltip on hover */
.agenda-event[title] {
  cursor: help;
}

.agenda-allday-event.client-vcgp { background: #bdd7e9; color: #1b3a4b; }
.agenda-allday-event.client-mpp { background: #c8ebc5; color: #0b3d0b; }
.agenda-allday-event.client-jtekt { background: #f5e8a8; color: #5c4b00; }
.agenda-allday-event.client-efi { background: #d4c4e0; color: #3b1f5e; }
.agenda-allday-event.client-interne { background: #f5cdd3; color: #6d0519; }
.agenda-allday-event.client-unknown { background: #e0e0e0; color: #323130; }
.agenda-allday-event.show-oof { background: #fecdd3 !important; color: #7f1d1d !important; }
