/* ============================================
   Sleep Studio - Dashboard Theme
   ============================================ */

:root {
    /* Core colors */
    --bg-dark: #0a0a0f;
    --bg-panel: #12121a;
    --bg-card: #1a1a24;
    --bg-hover: #22222e;
    --bg-input: #0d0d12;

    /* Accent colors */
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-info: #3b82f6;

    /* Text colors */
    --text-primary: #f1f1f4;
    --text-secondary: #71717a;
    --text-muted: #52525b;

    /* Borders */
    --border-subtle: #27272a;
    --border-light: #3f3f46;

    /* Effects */
    --glow-primary: 0 0 20px rgba(99, 102, 241, 0.3);
    --glow-success: 0 0 20px rgba(16, 185, 129, 0.3);

    /* Sizing */
    --sidebar-width: 220px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   Layout
   ============================================ */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-panel);
    border-right: 1px solid var(--border-subtle);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
    margin-bottom: 32px;
}

.brand-icon {
    font-size: 28px;
    color: var(--accent-primary);
}

.brand-text {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

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

.nav-item.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-stats {
    margin-top: auto;
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

/* Sidebar User */
.sidebar-user {
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.user-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.user-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.user-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.user-name {
    flex: 1;
    text-align: left;
    font-size: 13px;
    font-weight: 500;
}

.mini-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.mini-stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-primary);
}

.mini-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    min-height: 100vh;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.time-widget {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.current-time {
    font-size: 42px;
    font-weight: 300;
    letter-spacing: -2px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.current-date {
    font-size: 14px;
    color: var(--text-secondary);
}

.btn-add {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--glow-primary);
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.4);
}

.btn-add span {
    font-size: 18px;
    font-weight: 300;
}

/* ============================================
   Dashboard Grid
   ============================================ */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto auto 1fr;
    gap: 24px;
}

/* Panels */
.panel {
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
}

.panel-header h2 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.panel-badge {
    font-size: 12px;
    padding: 4px 10px;
    background: var(--bg-card);
    border-radius: 20px;
    color: var(--text-secondary);
}

.panel-badge.warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-warning);
}

.panel-badge.danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-danger);
}

/* Overview Panel */
.panel-overview {
    grid-column: 1 / -1;
}

.overview-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    padding: 24px;
}

.overview-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.overview-card:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.overview-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 20px;
}

.overview-icon.start {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.overview-icon.bed {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-secondary);
}

.overview-icon.wake {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-warning);
}

.overview-icon.available {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-info);
}

.overview-info {
    display: flex;
    flex-direction: column;
}

.overview-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.overview-value {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

/* REM Panel */
.panel-rem {
    grid-row: 2 / 4;
    grid-column: 2;
}

.rem-content {
    padding: 20px;
}

/* Sleep Summary */
.sleep-summary {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 16px;
}

.sleep-main {
    flex-shrink: 0;
}

.sleep-ring {
    position: relative;
    width: 100px;
    height: 100px;
}

.sleep-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.rem-ring-bg {
    fill: none;
    stroke: var(--bg-card);
    stroke-width: 8;
}

.rem-ring-fill {
    fill: none;
    stroke: url(#remGradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 70;
    transition: stroke-dashoffset 0.5s ease;
}

.rem-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.rem-cycles {
    display: block;
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.rem-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sleep-details {
    flex: 1;
}

.sleep-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.sleep-stat:last-child {
    border-bottom: none;
}

.sleep-stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.sleep-stat-value {
    font-size: 14px;
    font-weight: 600;
}

.sleep-stat-value.highlight {
    color: var(--accent-primary);
    font-size: 16px;
}

/* Sleep Recommendation */
.sleep-recommendation {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border-left: 3px solid var(--accent-success);
}

.sleep-recommendation.warning {
    border-left-color: var(--accent-warning);
}

.sleep-recommendation.danger {
    border-left-color: var(--accent-danger);
}

.recommendation-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.recommendation-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.rem-suggestions {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
}

.rem-title {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.bedtime-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bedtime-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-panel);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.bedtime-option:hover {
    border-color: var(--accent-primary);
}

.bedtime-option.recommended {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.15);
}

.bedtime-option.recommended::after {
    content: '✓';
    margin-left: 8px;
    color: var(--accent-primary);
    font-weight: 600;
}

.bedtime-option-time {
    font-weight: 600;
}

.bedtime-option-info {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Schedule Panel */
.panel-schedule {
    grid-column: 1;
    grid-row: 2 / 4;
    display: flex;
    flex-direction: column;
}

.schedule-controls {
    display: flex;
    gap: 12px;
}

.buffer-indicator {
    font-size: 12px;
    padding: 4px 10px;
    background: var(--bg-card);
    border-radius: 20px;
    color: var(--text-secondary);
}

/* Conflict Banner */
.conflict-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
    border-bottom: 1px solid rgba(239, 68, 68, 0.3);
}

.conflict-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.conflict-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-danger);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
}

.conflict-actions {
    display: flex;
    gap: 8px;
}

.conflict-btn {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.conflict-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

/* Schedule Timeline */
.schedule-timeline {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

.schedule-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 12px 0;
    position: relative;
}

.schedule-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 39px;
    top: 44px;
    bottom: -12px;
    width: 2px;
    background: var(--border-subtle);
}

.schedule-time {
    min-width: 70px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    padding-top: 2px;
}

.schedule-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-light);
    flex-shrink: 0;
    margin-top: 4px;
    position: relative;
    z-index: 1;
}

.schedule-item.now .schedule-marker {
    background: var(--accent-success);
    box-shadow: var(--glow-success);
}

.schedule-item.task .schedule-marker {
    background: var(--accent-primary);
}

.schedule-item.bedtime .schedule-marker {
    background: var(--accent-secondary);
}

.schedule-item.buffer .schedule-marker {
    background: transparent;
    border: 2px dashed var(--border-light);
}

.schedule-content {
    flex: 1;
    min-width: 0;
}

.schedule-title {
    font-weight: 500;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.schedule-title .icon {
    font-size: 16px;
}

.schedule-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.schedule-item.now .schedule-title {
    color: var(--accent-success);
}

.schedule-item.buffer {
    padding: 6px 0;
}

.schedule-item.buffer .schedule-title {
    font-size: 12px;
    color: var(--text-muted);
}

.schedule-item.skipped {
    opacity: 0.4;
}

.schedule-item.skipped .schedule-title {
    text-decoration: line-through;
}

.schedule-bar {
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.schedule-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

.priority-1 .schedule-bar-fill { background: var(--text-muted); }
.priority-2 .schedule-bar-fill { background: var(--accent-info); }
.priority-3 .schedule-bar-fill { background: var(--accent-success); }
.priority-4 .schedule-bar-fill { background: var(--accent-warning); }
.priority-5 .schedule-bar-fill { background: var(--accent-danger); }

/* Modal Large (for Tasks) */
.modal-large {
    max-width: 700px;
}

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

/* Auth Modal */
.auth-form {
    padding: 8px 0;
}

.btn-full {
    width: 100%;
    margin-top: 8px;
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--accent-danger);
    color: var(--accent-danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 12px;
}

.auth-error a {
    color: var(--accent-primary);
    text-decoration: underline;
    cursor: pointer;
}

.auth-error a:hover {
    color: var(--accent-secondary);
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--accent-primary);
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* User Menu */
.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 20px;
}

.user-avatar-large {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    font-size: 22px;
    font-weight: 600;
    color: white;
}

.user-details {
    flex: 1;
}

.user-name-large {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.user-email {
    font-size: 13px;
    color: var(--text-muted);
}

.subscription-info {
    text-align: center;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.subscription-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.subscription-badge.free {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.subscription-badge.pro {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.subscription-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

.user-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-danger-text {
    color: var(--accent-danger) !important;
}

.btn-danger-text:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

/* Users Management */
.users-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.search-box {
    flex: 1;
    max-width: 300px;
}

.search-box .form-input {
    padding-left: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}

.users-stats {
    display: flex;
    gap: 8px;
}

.stat-pill {
    padding: 6px 12px;
    background: var(--bg-card);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-muted);
}

.stat-pill.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.user-row:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.user-row-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 50%;
    font-size: 16px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

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

.user-row-name {
    font-weight: 500;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-row-email {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-row-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.user-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.user-badge.admin {
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-secondary);
}

.user-badge.user {
    background: var(--bg-hover);
    color: var(--text-muted);
}

.user-badge.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-success);
}

.user-badge.suspended {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-danger);
}

.user-row-date {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 80px;
    text-align: right;
}

.user-row-actions {
    display: flex;
    gap: 4px;
}

.user-row-action {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.user-row-action:hover {
    background: var(--bg-panel);
    color: var(--text-primary);
}

/* Edit User Modal */
.user-profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.user-profile-info {
    flex: 1;
}

.user-profile-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.user-profile-id {
    font-size: 12px;
    color: var(--text-muted);
}

/* User row edit button */
.user-row-edit {
    padding: 6px 14px;
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.user-row-edit:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Users loading, empty, and error states */
.loading-users,
.users-error,
.no-users {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

.users-error {
    color: var(--accent-danger);
}

/* Empty users state */
.users-empty {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

.users-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-body-scroll {
    max-height: 60vh;
    overflow-y: auto;
}

.modal-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 16px 0;
}

.btn-add-small {
    padding: 6px 14px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-small:hover {
    transform: translateY(-1px);
    box-shadow: var(--glow-primary);
}

.panel-hint {
    font-size: 12px;
    color: var(--text-muted);
    padding: 0 24px 16px;
    margin: 0;
}

/* Task Grid */
.task-grid {
    padding: 0 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
}

.task-card {
    display: flex;
    align-items: stretch;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    transition: all 0.2s;
    cursor: grab;
}

.task-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.task-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.task-card.drag-over {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.task-card.disabled {
    opacity: 0.5;
}

.task-card-priority {
    width: 6px;
    flex-shrink: 0;
}

.task-card-priority.p1 { background: var(--text-muted); }
.task-card-priority.p2 { background: var(--accent-info); }
.task-card-priority.p3 { background: var(--accent-success); }
.task-card-priority.p4 { background: var(--accent-warning); }
.task-card-priority.p5 { background: var(--accent-danger); }

.task-card-drag {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    color: var(--text-muted);
    font-size: 14px;
    cursor: grab;
    flex-shrink: 0;
}

.task-card-drag:hover {
    color: var(--text-secondary);
}

.task-card-main {
    flex: 1;
    padding: 14px 16px;
    min-width: 0;
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.task-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.task-card-icon {
    font-size: 20px;
}

.task-card-name {
    font-weight: 600;
    font-size: 15px;
}

.task-card-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.task-card-badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.task-card-badge.priority {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent-primary);
}

.task-card-badge.priority.p1 { background: rgba(82, 82, 91, 0.3); color: var(--text-muted); }
.task-card-badge.priority.p2 { background: rgba(59, 130, 246, 0.2); color: var(--accent-info); }
.task-card-badge.priority.p3 { background: rgba(16, 185, 129, 0.2); color: var(--accent-success); }
.task-card-badge.priority.p4 { background: rgba(245, 158, 11, 0.2); color: var(--accent-warning); }
.task-card-badge.priority.p5 { background: rgba(239, 68, 68, 0.2); color: var(--accent-danger); }

.task-card-badge.duration {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.task-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.task-card-time {
    color: var(--accent-success);
    font-weight: 500;
}

.task-card-actions {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.task-card-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.task-card-action:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.task-card-action.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-danger);
}

.task-card-action + .task-card-action {
    border-top: 1px solid var(--border-subtle);
}

/* Empty task grid */
.task-grid-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.task-grid-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.task-list {
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.task-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.task-item.disabled {
    opacity: 0.5;
}

.task-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.task-icon {
    font-size: 18px;
}

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

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

.task-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.task-priority {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

.task-priority.p1 { background: rgba(82, 82, 91, 0.3); color: var(--text-muted); }
.task-priority.p2 { background: rgba(59, 130, 246, 0.2); color: var(--accent-info); }
.task-priority.p3 { background: rgba(16, 185, 129, 0.2); color: var(--accent-success); }
.task-priority.p4 { background: rgba(245, 158, 11, 0.2); color: var(--accent-warning); }
.task-priority.p5 { background: rgba(239, 68, 68, 0.2); color: var(--accent-danger); }

.task-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.task-item:hover .task-actions {
    opacity: 1;
}

.task-action {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.task-action:hover {
    background: var(--bg-panel);
    color: var(--text-primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
}

/* ============================================
   Modals
   ============================================ */

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.modal-top {
    z-index: 1100;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 480px;
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
}

.modal-footer-right {
    display: flex;
    gap: 12px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.strength-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-card);
    border-radius: 2px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-text {
    font-size: 11px;
    font-weight: 500;
    min-width: 60px;
}

.password-strength.weak .strength-fill {
    width: 25%;
    background: var(--accent-danger);
}
.password-strength.weak .strength-text {
    color: var(--accent-danger);
}

.password-strength.fair .strength-fill {
    width: 50%;
    background: var(--accent-warning);
}
.password-strength.fair .strength-text {
    color: var(--accent-warning);
}

.password-strength.good .strength-fill {
    width: 75%;
    background: var(--accent-info);
}
.password-strength.good .strength-text {
    color: var(--accent-info);
}

.password-strength.strong .strength-fill {
    width: 100%;
    background: var(--accent-success);
}
.password-strength.strong .strength-text {
    color: var(--accent-success);
}

.input-with-suffix {
    position: relative;
}

.input-with-suffix .form-input {
    padding-right: 50px;
}

.input-suffix {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--text-muted);
}

/* Duration Input Group */
.duration-input-group {
    display: flex;
    gap: 8px;
}

.duration-input-group .form-input {
    flex: 1;
}

.duration-toggle {
    display: flex;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.duration-unit {
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.duration-unit:hover {
    color: var(--text-primary);
}

.duration-unit.active {
    background: var(--accent-primary);
    color: white;
}

/* Sessions Input */
.sessions-input {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 4px;
}

.session-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.session-btn:hover {
    background: var(--accent-primary);
    color: white;
}

.session-count {
    min-width: 40px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
}

/* Form Divider */
.form-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 20px 0;
}

/* Manual Time & Custom Buffer Groups */
.manual-time-group,
.custom-buffer-group {
    margin-left: 24px;
    padding-left: 16px;
    border-left: 2px solid var(--accent-primary);
}

/* Priority Picker */
.priority-picker {
    display: flex;
    gap: 8px;
}

.priority-btn {
    flex: 1;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.priority-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.priority-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.priority-hint {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Toggle Switch */
.toggle-label {
    display: flex !important;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.toggle-label input {
    display: none;
}

.toggle-switch {
    width: 44px;
    height: 24px;
    background: var(--bg-card);
    border-radius: 12px;
    position: relative;
    transition: all 0.2s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: var(--text-secondary);
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.2s;
}

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

.toggle-label input:checked + .toggle-switch::after {
    left: 23px;
    background: white;
}

/* Buttons */
.btn-primary {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--glow-primary);
}

.btn-secondary {
    padding: 12px 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-delete {
    padding: 12px 24px;
    background: transparent;
    border: 1px solid var(--accent-danger);
    border-radius: var(--radius-md);
    color: var(--accent-danger);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Settings Sections */
.settings-section {
    margin-bottom: 32px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

/* Utility */
.hidden {
    display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1024px) {
    .overview-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .panel-rem {
        grid-row: auto;
        grid-column: auto;
    }

    .panel-schedule {
        grid-row: auto;
        grid-column: auto;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
    }

    .overview-cards {
        grid-template-columns: 1fr 1fr;
    }

    .current-time {
        font-size: 32px;
    }

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

    .conflict-banner {
        flex-direction: column;
        gap: 12px;
    }

    .conflict-actions {
        width: 100%;
        justify-content: stretch;
    }

    .conflict-btn {
        flex: 1;
    }
}

/* ============================================
   Animations
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.schedule-item {
    animation: fadeIn 0.3s ease forwards;
}

.modal-content {
    animation: fadeIn 0.2s ease forwards;
}
