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

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

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

/* Login Screen */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.login-card > p {
    color: #666;
    font-size: 14px;
    margin-bottom: 30px;
}

.login-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 15px;
    border: 1px solid #fecaca;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-header p {
    font-size: 12px;
    opacity: 0.6;
    margin-top: 4px;
}

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

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.5;
    padding: 0 20px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.nav-item.active {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left-color: #10a37f;
}

.nav-item-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-item-badge {
    margin-left: auto;
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

/* Main Content */
.main {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a2e;
}

.page-subtitle {
    color: #666;
    font-size: 14px;
    margin-top: 4px;
}

.page-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Date Picker */
.date-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 8px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.date-picker label {
    font-size: 13px;
    color: #666;
}

.date-picker input[type="date"] {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

.date-picker input[type="date"]:focus {
    outline: none;
    border-color: #10a37f;
}

.date-nav {
    display: flex;
    gap: 5px;
}

.date-nav button {
    padding: 6px 10px;
    font-size: 12px;
    background: #f0f0f0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.date-nav button:hover {
    background: #e0e0e0;
}

/* Buttons */
button {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #10a37f;
    color: white;
}

.btn-primary:hover {
    background: #0d8a6a;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* List Items */
.list-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: all 0.2s;
}

.list-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.list-item-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 18px;
}

.list-item-avatar.project {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border-radius: 10px;
}

.list-item-content {
    flex: 1;
}

.list-item-title {
    font-weight: 600;
    color: #1a1a2e;
}

.list-item-subtitle {
    font-size: 13px;
    color: #666;
}

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #10a37f;
}

.form-group textarea {
    min-height: 200px;
    resize: vertical;
    font-family: inherit;
}

/* Rich text input */
.rich-input {
    min-height: 200px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    overflow-y: auto;
    white-space: pre-wrap;
    background: white;
}

.rich-input:focus {
    outline: none;
    border-color: #10a37f;
}

.rich-input:empty::before {
    content: attr(data-placeholder);
    color: #999;
    pointer-events: none;
}

.rich-input ul, .rich-input ol {
    margin: 0;
    padding-left: 20px;
}

.rich-input li {
    margin: 4px 0;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

/* Status Editor */
.status-section {
    margin-bottom: 25px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.status-section-header {
    background: #f8f9fa;
    padding: 12px 15px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-section-body {
    padding: 15px;
}

.task-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #fafafa;
    border-radius: 8px;
    margin-bottom: 8px;
}

.task-row:last-child {
    margin-bottom: 0;
}

.task-text {
    flex: 1;
    font-size: 14px;
}

.status-buttons {
    display: flex;
    gap: 5px;
}

.status-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid #ddd;
    background: white;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.status-btn:hover {
    transform: scale(1.1);
}

.status-btn.active.completed { background: #d4edda; border-color: #27ae60; }
.status-btn.active.blocked { background: #f8d7da; border-color: #e74c3c; }
.status-btn.active.failed { background: #f5c6cb; border-color: #c0392b; }
.status-btn.active.none { background: #e8e8e8; border-color: #999; }

/* Consistency warnings */
.consistency-warning {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.consistency-warning .warning-header {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 8px;
    color: #856404;
}

.consistency-warning p {
    color: #856404;
    font-size: 13px;
    margin-bottom: 8px;
}

.consistency-warning ul {
    margin: 0;
    padding-left: 20px;
    color: #856404;
    font-size: 13px;
}

.consistency-warning li {
    margin: 4px 0;
}

.task-row.task-issue {
    background: #fff3cd;
    border: 1px solid #ffc107;
}

.issue-badge {
    font-size: 11px;
    color: #856404;
    background: #fff3cd;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
}

/* Hours input styles */
.hours-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.hours-row {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.hours-row label {
    min-width: 220px;
    font-weight: 500;
    color: #333;
}

.hours-input-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.hours-input {
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
}

.hours-input.hours-hm {
    width: 65px;
}

.hours-input:focus {
    outline: none;
    border-color: #10a37f;
}

.hours-unit {
    color: #999;
    font-size: 13px;
    font-weight: 500;
    margin-right: 6px;
}

.hours-separator {
    color: #666;
    font-weight: 600;
    margin: 0 6px;
}

.hours-week-label {
    margin-top: 15px;
    margin-bottom: 8px;
    color: #666;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
}

.hours-row-today {
    background: #f0faf6;
    border-radius: 6px;
    padding: 4px 8px;
}

.hours-summary {
    margin-top: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.hours-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.hours-summary-row span:first-child {
    font-weight: 500;
}

.hours-status {
    padding: 6px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    margin-left: 4px;
}

/* Status toggle */
.status-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.status-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.status-toggle-label {
    font-weight: 500;
    color: #e74c3c;
}

.status-toggle input:checked + .status-toggle-label {
    color: #27ae60;
}

/* Comparison styles */
.comparison-section {
    margin-bottom: 15px;
}

.comparison-section h5 {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.comparison-item {
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 6px;
    font-size: 14px;
}

.comparison-item.completed {
    background: #d4edda;
    color: #155724;
}

.comparison-item.new-task {
    background: #cce5ff;
    color: #004085;
}

.comparison-item.still-blocked {
    background: #fff3cd;
    color: #856404;
}

.comparison-item.removed {
    background: #f8d7da;
    color: #721c24;
    text-decoration: line-through;
}

/* Output */
.output-box {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.tab {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}

.tab:hover {
    color: #333;
}

.tab.active {
    color: #10a37f;
    border-bottom-color: #10a37f;
}

/* Worker selector */
.worker-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.worker-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #f5f5f5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.worker-checkbox:hover {
    background: #e8e8e8;
}

.worker-checkbox.selected {
    background: #d4edda;
    border-color: #27ae60;
}

.worker-checkbox input {
    display: none;
}

/* History */
.history-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    background: #f0f0f0;
}

.history-item.active {
    background: #e8f5e9;
    border: 2px solid #27ae60;
}

.history-date {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.history-content {
    font-size: 14px;
    white-space: pre-wrap;
    max-height: 100px;
    overflow: hidden;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 25px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    color: #999;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: #27ae60;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s;
    z-index: 2000;
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top-color: #10a37f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 8px;
}

.quick-btn {
    padding: 4px 10px;
    font-size: 11px;
    background: #e8e8e8;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.quick-btn:hover {
    background: #ddd;
}

/* File inputs */
.file-input {
    display: none;
}

/* Settings */
.settings-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h3 {
    margin-bottom: 15px;
    color: #1a1a2e;
}

.settings-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 15px;
}

.settings-row .form-group {
    margin-bottom: 0;
    flex: 1;
}

/* Milestone Table */
.milestone-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.milestone-table th,
.milestone-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.milestone-table th {
    font-weight: 600;
    color: #666;
    font-size: 13px;
    text-transform: uppercase;
}

.milestone-table input[type="text"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.milestone-table input[type="number"] {
    width: 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-align: center;
}

.milestone-table input[type="date"] {
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.milestone-deadline {
    font-weight: 500;
    color: #333;
}

.milestone-deadline.overdue {
    color: #e74c3c;
}

.milestone-deadline.soon {
    color: #f39c12;
}

.milestone-deadline.ok {
    color: #27ae60;
}

.milestone-progress {
    display: flex;
    align-items: center;
    gap: 4px;
}

.milestone-progress .task-input {
    width: 50px;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.milestone-progress .task-separator {
    color: #999;
    font-weight: 500;
}

.milestone-percent {
    min-width: 50px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    text-align: center;
    margin-left: 8px;
}

.milestone-percent.low {
    background: #fee2e2;
    color: #dc2626;
}

.milestone-percent.half {
    background: #fef3c7;
    color: #d97706;
}

.milestone-percent.complete {
    background: #d1fae5;
    color: #059669;
}

.milestone-progress-bar {
    width: 80px;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-left: 8px;
}

.milestone-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.milestone-progress-fill.low {
    background: #ef4444;
}

.milestone-progress-fill.half {
    background: #f59e0b;
}

.milestone-progress-fill.complete {
    background: #10b981;
}

.milestone-delete {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
}

.milestone-delete:hover {
    color: #e74c3c;
}

.timeline-bar {
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    margin: 15px 0;
    position: relative;
    overflow: hidden;
}

.timeline-progress {
    height: 100%;
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    border-radius: 4px;
    transition: width 0.3s;
}

/* Milestone Sub-Tabs */
.milestone-set-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 0;
    flex-wrap: wrap;
}

.milestone-set-tab {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 0;
}

.milestone-set-tab:hover {
    color: #333;
    background: #f5f5f5;
}

.milestone-set-tab.active {
    color: #10a37f;
    border-bottom-color: #10a37f;
    font-weight: 600;
}

.milestone-set-tab.add-set-btn {
    color: #999;
    font-size: 16px;
    padding: 8px 12px;
}

.milestone-set-tab.add-set-btn:hover {
    color: #10a37f;
}

.milestone-set-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.milestone-set-header input[type="text"] {
    font-size: 16px;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 6px 10px;
    background: transparent;
    color: #1a1a2e;
    transition: all 0.2s;
}

.milestone-set-header input[type="text"]:hover,
.milestone-set-header input[type="text"]:focus {
    border-color: #ddd;
    background: #f8f9fa;
    outline: none;
}

.milestone-set-delete {
    padding: 4px 10px;
    font-size: 12px;
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #999;
    cursor: pointer;
}

.milestone-set-delete:hover {
    border-color: #e74c3c;
    color: #e74c3c;
    background: #fef2f2;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

.sidebar-user {
    color: rgba(255,255,255,0.7);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout {
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    text-decoration: none;
    font-size: 12px;
}

.sidebar-logout:hover {
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .sidebar-header h1,
    .sidebar-header p,
    .nav-section-title,
    .nav-item span:not(.nav-item-icon) {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 15px;
    }

    .main {
        margin-left: 60px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
