:root {
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --primary-light: #eef2ff;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Header */
.app-header {
    background: white;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.app-header-inner {
    max-width: 430px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}
.app-header-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}
.app-header-user {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Cards */
.app-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    text-decoration: none;
    display: block;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, transform 0.15s;
}
.app-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    color: var(--text);
}
.app-card h5 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--primary);
}
.app-card h5.mb-0 {
    color: var(--text);
}
.app-card small {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Primary card (big CTA like "Выполнить работу") */
.app-card-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    border: none;
    color: white;
    box-shadow: var(--shadow-md);
}
.app-card-primary:hover {
    color: white;
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.app-card-primary h4 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

/* Card for work items (report_summary, calendar) */
.app-card-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}
.app-card-item h6 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.app-card-item p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.app-card-item strong {
    color: var(--text);
}

/* Buttons */
.app-btn {
    background: var(--primary-600);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}
.app-btn:hover {
    background: var(--primary-700);
    color: white;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.app-btn:active {
    transform: translateY(0);
}
.app-btn-outline {
    background: transparent;
    color: var(--primary-600);
    border: 2px solid var(--primary-600);
}
.app-btn-outline:hover {
    background: var(--primary-50);
    color: var(--primary-700);
    border-color: var(--primary-700);
}
.app-btn-success {
    background: var(--success);
}
.app-btn-success:hover {
    background: #059669;
}
.app-btn-danger {
    background: var(--danger);
}
.app-btn-danger:hover {
    background: #dc2626;
}
.app-btn-sm {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

/* Inputs */
.app-input {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 15px;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: white;
}
.app-input:focus {
    border-color: var(--primary-600);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    outline: none;
}
textarea.app-input {
    resize: vertical;
    min-height: 80px;
}

/* Back link */
.app-back {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}
.app-back:hover {
    color: var(--primary-600);
}

/* Section title */
.app-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}
.app-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.app-section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-top: 20px;
    margin-bottom: 12px;
}

/* Labels */
.app-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

/* Dashboard menu */
.app-menu-item {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, transform 0.15s;
}
.app-menu-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    color: var(--text);
}
.app-menu-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.app-menu-icon-primary {
    background: var(--primary-100);
    color: var(--primary-600);
}
.app-menu-icon-success {
    background: #d1fae5;
    color: var(--success);
}
.app-menu-icon-warning {
    background: #fef3c7;
    color: var(--warning);
}
.app-menu-text h5 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 1px;
}
.app-menu-text small {
    font-size: 12px;
    color: var(--text-muted);
}

/* Work node header */
.app-node-header {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: white;
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 16px;
}
.app-node-header h5 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
    color: white;
}
.app-node-header small {
    font-size: 13px;
    opacity: 0.85;
    color: white;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: 90%;
    max-width: 400px;
}
.app-toast {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toast-in 0.3s ease-out;
    margin-bottom: 8px;
}
.app-toast-success { border-left: 4px solid var(--success); }
.app-toast-error { border-left: 4px solid var(--danger); }
.app-toast-warning { border-left: 4px solid var(--warning); }
.app-toast-icon { font-size: 18px; flex-shrink: 0; }
.app-toast-text { font-size: 14px; color: var(--text); flex: 1; }
.app-toast-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-10px); }
}

/* Worker card (report_summary) */
.app-worker-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
}
.app-worker-card .worker-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.app-worker-card .remove-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.app-worker-card .remove-btn:hover {
    color: var(--danger);
}

/* Report card (calendar) */
.app-report-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}
.app-report-card h5 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
}
.app-report-card hr {
    margin: 8px 0;
    border-color: var(--border);
}

/* Timesheet */
.app-timesheet-wrapper {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.app-timesheet-table {
    min-width: 820px;
    color: var(--text);
    font-size: 13px;
    margin-bottom: 0;
}
.app-timesheet-table th,
.app-timesheet-table td {
    min-width: 34px;
    height: 34px;
    border-color: var(--border);
    white-space: nowrap;
    padding: 4px 6px;
    vertical-align: middle;
}
.app-timesheet-table thead th {
    background: var(--primary-50);
    font-weight: 600;
    font-size: 12px;
    color: var(--primary-700);
    position: sticky;
    top: 0;
}
.app-timesheet-name {
    position: sticky;
    left: 0;
    z-index: 1;
    min-width: 150px;
    max-width: 150px;
    background: white;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    font-size: 13px;
}
thead .app-timesheet-name {
    z-index: 2;
    background: var(--primary-50);
}

/* Login */
.app-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
    padding: 20px;
}
.app-login-card {
    background: white;
    border-radius: 16px;
    padding: 32px 24px;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
}
.app-login-card h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    text-align: center;
    margin-bottom: 24px;
}

/* Misc */
.app-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 14px;
}
.app-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}
