/**
 * Parking Manager - Consolidated Styles
 * Single CSS file for all pages
 */

/* ============================================================================
   CSS Variables
   ============================================================================ */
:root {
    --primary: #1f1f1f;
    --primary-hover: #333;
    --secondary: #6b7280;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --text: #1f1f1f;
    --text-secondary: #666;
    --text-muted: #999;
    --border: #e5e5e5;
    --border-dark: #d0d0d0;
    --bg: #f9fafb;
    --bg-white: #fff;
    --sidebar-width: 260px;
    --header-height: 64px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    cursor: pointer;
}

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

/* ============================================================================
   Layout - Sidebar
   ============================================================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: white;
    color: var(--text);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 0 1.5rem;
    min-height: 53px;
    display: flex;
    align-items: center;
}

.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--bg);
    color: var(--text);
}

.nav-item.active {
    background: var(--bg);
    color: var(--text);
    font-weight: 500;
}

.sidebar-footer {
    padding: 1rem;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    text-align: left;
}

.user-button:hover {
    background: #eee;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.user-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    color: var(--text);
    background: none;
    border: none;
    text-align: left;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background: var(--bg);
}

.dropdown-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0.25rem 0;
}

/* ============================================================================
   Layout - Main Content
   ============================================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    min-height: 53px;
    background: white;
    border-bottom: 1px solid var(--border);
    gap: 0.75rem;
}

.page-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    flex: 1;
    min-width: 0;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.content-wrapper {
    flex: 1;
    padding: 1rem 1.5rem;
}

/* ============================================================================
   Cards
   ============================================================================ */
.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* ============================================================================
   Buttons
   ============================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-dark {
    background: var(--primary);
    color: white;
}

.btn-dark:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: white;
    color: var(--text);
    border: 1px solid var(--border-dark);
}

.btn-secondary:hover {
    background: var(--bg);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg);
}

.btn-full {
    width: 100%;
}

/* ============================================================================
   Forms
   ============================================================================ */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.form-input,
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.9rem;
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    background: white;
}

.form-input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Checkbox alignment */
.checkbox-group {
    margin-bottom: 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
}

/* ============================================================================
   Modals
   ============================================================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-small {
    max-width: 420px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
}

/* ============================================================================
   Messages & Badges
   ============================================================================ */
.message {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.message.success {
    background: var(--success-bg);
    color: #166534;
}

.message.error {
    background: var(--danger-bg);
    color: #991b1b;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
}

.badge-success {
    background: var(--success-bg);
    color: #166534;
}

.badge-warning {
    background: var(--warning-bg);
    color: #92400e;
}

.badge-danger {
    background: var(--danger-bg);
    color: #991b1b;
}

/* ============================================================================
   Tables
   ============================================================================ */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.table tbody tr:hover {
    background: var(--bg);
}

/* ============================================================================
   Calendar Components
   ============================================================================ */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    max-width: 100%;
}

.calendar-header h3 {
    margin: 0;
    font-size: 1rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: auto repeat(6, 1fr);
    gap: 4px;
    margin-bottom: 1rem;
    height: calc(100vh - 220px);
}

.calendar-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    padding: 0.5rem 0.25rem;
    position: relative;
    min-height: 0;
}

.calendar-day:hover {
    border-color: var(--primary);
}

.calendar-day.weekend {
    background: #f5f5f5;
}

.calendar-day.holiday {
    background: #fff7ed;
}

.calendar-day.today {
    border-color: var(--primary);
    border-width: 2px;
}

.calendar-day .day-number {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.2;
}

.calendar-day .day-name {
    font-size: 0.65rem;
    color: var(--text-secondary);
    line-height: 1;
}

.calendar-day .parking-badge {
    position: absolute;
    bottom: 6px;
    left: 4px;
    right: 4px;
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.3rem 0;
    border-radius: 6px;
    border: 1px solid #93c5fd;
    line-height: 1;
    text-align: center;
    transform: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Status colors */
.status-present {
    background: var(--success-bg) !important;
    border-color: var(--success) !important;
}

.status-remote {
    background: #dbeafe !important;
    border-color: #3b82f6 !important;
}

.status-absent {
    background: var(--danger-bg) !important;
    border-color: var(--danger) !important;
}

.status-nodata {
    background: white;
}

/* Closed Day */
.calendar-day.closed {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    border-color: #d1d5db;
}

.calendar-day.closed:hover {
    border-color: #d1d5db;
}

.calendar-day.closed .day-number {
    opacity: 0.5;
}

.team-calendar td.closed {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Legend */
.legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--border);
}

/* ============================================================================
   Status Buttons (for modals)
   ============================================================================ */
.status-buttons {
    display: flex;
    gap: 0.75rem;
}

.status-btn,
.status-change-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: white;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.status-btn:hover,
.status-change-btn:hover {
    border-color: var(--primary);
}

.status-btn.active,
.status-change-btn.active {
    border-color: var(--primary);
    background: var(--bg);
}

.status-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

/* ============================================================================
   Team Calendar Table
   ============================================================================ */
.team-calendar-wrapper {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.team-calendar {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.team-calendar th,
.team-calendar td {
    padding: 0.5rem;
    text-align: center;
    border: 1px solid var(--border);
    min-width: 36px;
}

.team-calendar th {
    background: var(--bg);
    font-weight: 500;
}

.team-calendar th.day-column {
    cursor: pointer;
}

.team-calendar th.day-column:hover {
    background: #eee;
}

.team-calendar th.day-column.selected {
    background: var(--primary);
    color: white;
}

.team-calendar th.weekend,
.team-calendar td.weekend {
    background: #f5f5f5;
}

.team-calendar th.holiday,
.team-calendar td.holiday {
    background: #fff7ed;
}

.team-calendar th.today {
    font-weight: 700;
}

.team-calendar td.today {
    border: 2px solid var(--primary);
}

.team-calendar .calendar-cell {
    cursor: pointer;
    transition: all 0.15s ease;
}

.team-calendar .calendar-cell:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: var(--primary);
}

.member-column {
    text-align: left !important;
    min-width: 150px;
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
}

.member-cell {
    text-align: left !important;
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
}

.member-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.day-cell {
    cursor: pointer;
}

.day-cell:hover {
    opacity: 0.8;
}

/* Summary footer */
.summary-row {
    background: var(--bg);
}

.summary-label-cell {
    text-align: left !important;
    font-weight: 500;
    position: sticky;
    left: 0;
    background: var(--bg);
}

.summary-cell {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.summary-cell.has-value {
    color: var(--text);
    font-weight: 500;
}

/* ============================================================================
   Parking Grid
   ============================================================================ */
.parking-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.parking-spot {
    background: white;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.parking-spot:hover {
    border-color: var(--primary);
}

.parking-spot.available {
    border-style: dashed;
}

.parking-spot.assigned {
    border-color: var(--success);
}

.parking-spot.my-spot {
    border-color: var(--primary);
    background: #f0f9ff;
}

.spot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.spot-id {
    font-weight: 600;
    font-size: 1.1rem;
}

.spot-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.spot-badge.available {
    background: var(--bg);
    color: var(--text-secondary);
}

.spot-badge.assigned {
    background: var(--success-bg);
    color: #166534;
}

.spot-badge.mine {
    background: #dbeafe;
    color: #1d4ed8;
}

.spot-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.spot-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.spot-user-name {
    font-weight: 500;
    font-size: 0.85rem;
}

.spot-user-office {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.spot-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================================================
   Toggle Switch
   ============================================================================ */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked+.toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(22px);
}

/* ============================================================================
   Auth Pages
   ============================================================================ */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 500;
}

/* ============================================================================
   Settings & Profile Specific
   ============================================================================ */
.settings-container,
.profile-container {
    max-width: 600px;
}

.settings-section,
.profile-section {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.settings-section h3,
.profile-section h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.settings-section p {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.setting-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.setting-item:first-child {
    padding-top: 0;
}

.setting-info label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.setting-info small {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.setting-control {
    margin-left: 1rem;
}

.setting-control select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 140px;
}

.profile-field {
    margin-bottom: 1rem;
}

.profile-field:last-child {
    margin-bottom: 0;
}

.profile-field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.profile-field .value {
    font-size: 1rem;
    color: var(--text);
}

.password-requirements {
    background: var(--bg);
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
}

.password-requirements ul {
    margin: 0.5rem 0 0 1.25rem;
    padding: 0;
}

.password-requirements li {
    margin-bottom: 0.25rem;
}

.password-requirements li.valid {
    color: var(--success);
}

.password-requirements li.invalid {
    color: var(--danger);
}

/* ============================================================================
   Office Rules Specific
   ============================================================================ */
.rules-container {
    display: grid;
    gap: 2rem;
    max-width: 1200px;
}

.rule-section {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
}

.rule-section h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.rule-section p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.weekday-list,
.weekday-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    margin-bottom: 1rem;
}

.weekday-list label,
.weekday-checkboxes label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.weekday-list input[type="checkbox"],
.weekday-checkboxes input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.add-rule-form {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 6px;
}

.add-rule-form .btn {
    justify-self: end;
}

.form-row {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.rule-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
}

.rule-info strong {
    color: var(--text);
}

.rule-info small {
    display: block;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.header-select {
    min-width: 200px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-dark);
    border-radius: 4px;
    font-size: 0.9rem;
    background: white;
}

/* ============================================================================
   Admin Tables
   ============================================================================ */
.admin-table {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.admin-table table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.875rem;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: var(--bg);
}

.actions-cell {
    display: flex;
    gap: 0.5rem;
}

/* ============================================================================
   Card Headers
   ============================================================================ */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h3 {
    margin: 0;
}

.card-body {
    padding: 0;
}

/* ============================================================================
   Data Tables
   ============================================================================ */
.data-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.data-table tbody tr:hover {
    background: var(--bg);
}

/* ============================================================================
   Team Calendar Table
   ============================================================================ */
.team-calendar-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.team-calendar-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
}

.team-calendar-table th,
.team-calendar-table td {
    padding: 0.5rem;
    text-align: center;
    border: 1px solid var(--border);
    border-left: none;
    border-top: none;
}

.team-calendar-table th:first-child,
.team-calendar-table td:first-child {
    border-left: 1px solid var(--border);
}

.team-calendar-table thead tr:first-child th {
    border-top: 1px solid var(--border);
}

.team-calendar-table th {
    background: var(--bg);
    font-weight: 500;
}

.team-calendar-table th.weekend,
.team-calendar-table td.weekend {
    background: #f5f5f5;
}

.team-calendar-table th.holiday,
.team-calendar-table td.holiday {
    background: #fff7ed;
}

.team-calendar-table .member-name {
    text-align: left;
    min-width: 160px;
    font-weight: 500;
}

.team-calendar-table .member-name {
    text-align: left !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.team-calendar-table .member-office {
    text-align: left !important;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.team-calendar-table .calendar-cell {
    min-width: 40px;
    position: relative;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.team-calendar-table .calendar-cell:hover {
    box-shadow: inset 0 0 0 1px var(--primary);
}

.team-calendar-table .calendar-cell.status-present {
    background: var(--success-bg) !important;
    border-color: var(--border) !important;
}

.team-calendar-table .calendar-cell.status-remote {
    background: #dbeafe !important;
    border-color: var(--border) !important;
}

.team-calendar-table .calendar-cell.status-absent {
    background: var(--danger-bg) !important;
    border-color: var(--border) !important;
}

.team-calendar-table th.today,
.team-calendar-table td.today {
    box-shadow: inset 1px 0 0 var(--primary), inset -1px 0 0 var(--primary);
}

.team-calendar-table th.today {
    font-weight: 700;
    box-shadow: inset 1px 0 0 var(--primary), inset -1px 0 0 var(--primary), inset 0 1px 0 var(--primary);
}

.team-calendar-table tbody tr:last-child td.today {
    box-shadow: inset 1px 0 0 var(--primary), inset -1px 0 0 var(--primary), inset 0 -1px 0 var(--primary);
}

.team-calendar-table .calendar-cell.has-parking::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

.team-calendar-table .parking-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 20px;
}

.parking-badge-sm {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    font-size: 0.55rem;
    font-weight: 600;
    padding: 0.1rem 0.25rem;
    border-radius: 2px;
    line-height: 1;
}

/* ============================================================================
   Role Badges
   ============================================================================ */
.badge-employee {
    background: #e5e7eb;
    color: #374151;
}

.badge-manager {
    background: #dbeafe;
    color: #1e40af;
}

.badge-admin {
    background: #fae8ff;
    color: #86198f;
}

/* ============================================================================
   Toggle Label
   ============================================================================ */
.toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ============================================================================
   Rules List
   ============================================================================ */
.rules-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rules-list .rule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 6px;
}

.rules-list .rule-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.rules-list .rule-date,
.rules-list .rule-name {
    font-weight: 500;
}

.rules-list .rule-reason,
.rules-list .rule-email,
.rules-list .rule-date-range {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-icon.btn-danger {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-icon.btn-danger:hover {
    background: var(--danger-bg);
}

/* ============================================================================
   Input Group
   ============================================================================ */
.input-group {
    display: flex;
    gap: 0.5rem;
}

.input-group select {
    flex: 1;
}

/* ============================================================================
   Button Sizes
   ============================================================================ */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* ============================================================================
   Utility Classes
   ============================================================================ */
.text-center {
    text-align: center;
}

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

.form-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    min-width: 150px;
}

/* ============================================================================
   Presence Calendar Card
   ============================================================================ */
.card.presence-card {
    margin-bottom: 0;
}

/* ============================================================================
   Mobile Menu Toggle
   ============================================================================ */
.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.menu-toggle:hover {
    background: var(--bg);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* ============================================================================
   Responsive
   ============================================================================ */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .page-header {
        padding: 0.75rem 1rem;
    }

    .page-header h2 {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-actions {
        gap: 0.5rem;
    }

    .header-actions .form-select {
        min-width: 100px;
        font-size: 0.8rem;
        padding: 0.4rem 0.5rem;
    }

    .content-wrapper {
        padding: 0.75rem;
    }

    .calendar-grid {
        gap: 2px;
        /* On mobile, calculate height based on width to keep cells square-ish */
        /* 7 columns means each cell is ~14vw wide, so 7 rows = 7 * 14vw = 98vw */
        height: auto;
        max-height: none;
    }

    .calendar-day {
        font-size: 0.7rem;
        padding: 0.125rem;
        border-radius: 4px;
        /* Make cells square based on available width */
        aspect-ratio: 1;
    }

    .calendar-day .day-number {
        font-size: 0.75rem;
    }

    .calendar-day .day-name {
        font-size: 0.55rem;
    }

    .calendar-day .parking-badge {
        font-size: 0.5rem;
        padding: 0.05rem 0.2rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* Data tables responsive */
    .data-table {
        font-size: 0.8rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }

    /* Team calendar table responsive */
    .team-calendar-table .member-name,
    .team-calendar-table .member-office {
        max-width: 80px;
        font-size: 0.75rem;
    }
}

/* Toast Animations */
@keyframes slideInBottom {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}