/* ====================== RESET & BASE ====================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0B1120;
  --surface: #1E293B;
  --surface-2: #334155;
  --primary: #3B82F6;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --pending: #FBBF24;
  --text: #F8FAFC;
  --text-muted: #94A3B8;
  --border: #334155;
  --radius: 8px;
  --font: 'Inter', system-ui, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

button, input, select {
  font-family: inherit;
  font-size: inherit;
}

.hidden { display: none !important; }

/* ====================== TOP BAR ====================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}
.logo-sub {
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 6px;
  font-size: 14px;
}

.topbar-center {
  display: flex;
  gap: 4px;
}

.view-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}
.view-btn:hover { color: var(--text); background: var(--surface-2); }
.view-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.user-badge {
  font-size: 12px;
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: 20px;
  margin-right: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ====================== BUTTONS ====================== */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  width: 100%;
}
.btn-primary:hover { background: #2563EB; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }
.btn-ghost.full { width: 100%; margin-top: 12px; }

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 22px;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { background: var(--surface-2); }

/* ====================== LOGIN ====================== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px);
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
}

.login-card h1 {
  font-size: 22px;
  margin-bottom: 4px;
}
.login-sub {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-card label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  margin-top: 14px;
}
.login-card input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 6px;
  outline: none;
}
.login-card input:focus { border-color: var(--primary); }

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
}

/* ====================== MAIN LAYOUT ====================== */
.main-app {
  display: grid;
  grid-template-columns: 240px 1fr 0fr;
  height: calc(100vh - 56px);
  transition: grid-template-columns 0.2s ease;
}
.main-app.panel-open {
  grid-template-columns: 240px 1fr 380px;
}

/* ====================== SIDEBAR ====================== */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  overflow-y: auto;
}

.sidebar h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.filter-group {
  margin-bottom: 20px;
}
.filter-group > label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
  font-size: 13px;
}
.checkbox-list input { accent-color: var(--primary); }

.sidebar select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
}

/* switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--surface-2);
  border-radius: 24px;
  transition: 0.2s;
}
.slider:before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* ====================== CONTENT ====================== */
.content {
  padding: 20px;
  overflow-y: auto;
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.date-nav h2 {
  font-size: 18px;
  font-weight: 600;
  min-width: 160px;
  margin: 0 4px;
}

/* ====================== MONTH VIEW ====================== */
.weekday-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
}
.weekday-header span {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 0;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.day-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-height: 90px;
  padding: 6px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
}
.day-cell:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}
.day-cell.other-month {
  opacity: 0.35;
}
.day-cell.today {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.day-cell.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}
.day-cell.empty-weekend {
  border-style: dashed;
  border-color: var(--warning);
}

.day-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.day-cell.today .day-number { color: var(--primary); }

.day-chips {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chip {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.chip.pending { background: rgba(251, 191, 36, 0.2); color: var(--pending); }
.chip.active { background: rgba(59, 130, 246, 0.2); color: var(--primary); }
.chip.converted { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.chip.expired { background: rgba(100, 116, 139, 0.25); color: var(--text-muted); }
.chip.cancelled { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.empty-icon {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 11px;
  color: var(--warning);
}

/* ====================== TABLE VIEW ====================== */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:hover td { background: rgba(255,255,255,0.02); }

.status-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.status-pill.pending { background: rgba(251,191,36,0.2); color: var(--pending); }
.status-pill.active { background: rgba(59,130,246,0.2); color: var(--primary); }
.status-pill.converted { background: rgba(16,185,129,0.2); color: var(--success); }

/* ====================== AGENDA VIEW ====================== */
.agenda-day {
  margin-bottom: 24px;
}
.agenda-day-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.agenda-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.agenda-item:hover { border-color: var(--primary); }

/* ====================== DETAIL PANEL ====================== */
.detail-panel {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.detail-header h3 { font-size: 15px; font-weight: 600; }

.detail-content {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.hold-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
}
.hold-card h4 {
  font-size: 14px;
  margin-bottom: 6px;
}
.hold-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 4px 0;
}
.detail-row span:first-child { color: var(--text-muted); }

.promoter-card {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 10px;
  margin: 10px 0;
  font-size: 13px;
}
.promoter-card a {
  color: var(--primary);
  text-decoration: none;
}

.tech-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.tech-row select {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 6px;
}

.detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.detail-actions button {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.btn-approve { background: var(--success); color: white; }
.btn-edit { background: var(--surface-2); color: var(--text); }

/* ====================== RESPONSIVE ====================== */
@media (max-width: 900px) {
  .main-app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .main-app.panel-open {
    grid-template-columns: 1fr;
  }
  .detail-panel {
    position: fixed;
    top: 56px;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 420px;
    z-index: 90;
  }
  .day-cell { min-height: 70px; }
}
