* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #fce7f3 0%, #f3e8ff 100%);
    min-height: 100vh;
    padding: 16px;
    margin: 0;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}
.container {
    max-width: 800px;
    margin: 0 auto;
}
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 24px;
    margin-bottom: 16px;
}
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}
.icon {
    width: 32px;
    height: 32px;
    color: #3b82f6;
}
h1 {
    font-size: 24px;
    color: #1f2937;
}
.sync-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6b7280;
}
.sync-icon {
    width: 16px;
    height: 16px;
}
.sync-icon.synced { color: #10b981; }
.sync-icon.saving { color: #3b82f6; animation: pulse 1.5s infinite; }
.sync-icon.error { color: #ef4444; }
.sync-icon.offline { color: #9ca3af; }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
button {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
button:active {
    transform: scale(0.95);
}
.btn-primary {
    background: #3b82f6;
    color: white;
}
.btn-primary:hover:not(:disabled) {
    background: #2563eb;
}
.btn-primary.active {
    background: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}
.btn-danger {
    background: #ef4444;
    color: white;
}
.btn-danger:hover {
    background: #dc2626;
}
.btn-success {
    background: #10b981;
    color: white;
}
.btn-success:hover {
    background: #059669;
}
.btn-warning {
    background: #f59e0b;
    color: white;
}
.btn-warning:hover {
    background: #d97706;
}
.btn-action {
    padding: 18px 24px !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    min-width: 120px;
    min-height: 56px;
}
.btn-edit {
    background: #f59e0b;
    color: white;
}
.btn-edit:hover {
    background: #d97706;
}
.btn-edit.active {
    background: #10b981;
}
.btn-edit.active:hover {
    background: #059669;
}
.drag-handle {
    cursor: move;
    padding: 8px;
    color: #3b82f6;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    font-weight: bold;
}
.drag-handle:active {
    cursor: grabbing;
    color: #1d4ed8;
    transform: scale(1.2);
}
.employee-row.dragging {
    opacity: 0.3;
    background: #dbeafe;
    border: 3px dashed #3b82f6;
}
.employee-row.drag-over {
    background: #fbbf24;
    border: 4px solid #f59e0b;
    transform: scale(1.05);
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.5);
}
.employee-row.drag-over::before {
    content: '⬇️ DROP HERE';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #f59e0b;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    z-index: 1000;
    white-space: nowrap;
}
.employee-row {
    position: relative;
}
button:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}
.icon-btn {
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.next-banner {
    background: #3b82f6;
    color: white;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    margin-bottom: 24px;
}
.next-banner p:first-child {
    font-size: 14px;
    margin-bottom: 4px;
}
.next-banner .name {
    font-size: 28px;
    font-weight: bold;
    margin: 4px 0;
}
.next-banner .turn {
    font-size: 20px;
}
.edit-mode-banner {
    display: none;
    margin-bottom: 16px;
    padding: 16px;
    background: #fef3c7;
    border-radius: 8px;
    border: 2px solid #f59e0b;
}
.edit-mode-banner.active {
    display: block;
}
.edit-mode-banner p {
    color: #92400e;
    font-weight: 600;
    margin-bottom: 12px;
}
.add-employee {
    display: flex;
    gap: 8px;
}
.add-employee input {
    flex: 1;
    padding: 12px;
    border: 2px solid #f59e0b;
    border-radius: 8px;
    font-size: 16px;
}
.add-employee input:focus {
    outline: none;
    border-color: #d97706;
}
.working-count {
    color: #6b7280;
    font-weight: 600;
    margin-bottom: 8px;
}
.employee-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.employee-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    background: #f9fafb;
    position: relative;
    min-height: 70px;
}
.employee-row::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    bottom: -10px;
    pointer-events: none;
}
.employee-row.working {
    background: #fef3c7;
    border-color: #fbbf24;
}
.employee-row.half-turn {
    background: #dbeafe;
    border-color: #93c5fd;
}
.half-turn-btn {
    padding: 6px 10px;
    background: #e0f2fe;
    color: #0369a1;
    border: 2px solid #bae6fd;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 40px;
    min-height: 40px;
}
.half-turn-btn:hover {
    background: #bae6fd;
    border-color: #0369a1;
}
.half-turn-btn.active {
    background: #0369a1;
    color: white;
    border-color: #0369a1;
}
.employee-row.edit-mode-row {
    touch-action: none;
    cursor: move;
}
.employee-row:not(.edit-mode-row) {
    cursor: default;
    user-select: text;
    -webkit-user-select: text;
}
.employee-name {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}
.employee-name span {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}
.employee-name input {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    border: 2px solid #3b82f6;
    border-radius: 6px;
    padding: 4px 8px;
}
.edit-btn, .remove-btn {
    padding: 4px;
    background: transparent;
    color: #9ca3af;
    border: none;
    cursor: pointer;
}
.edit-btn:hover {
    color: #3b82f6;
}
.remove-btn:hover {
    color: #ef4444;
}
.turn-input {
    width: 80px;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: #3b82f6;
    border: 2px solid #93c5fd;
    border-radius: 8px;
    padding: 8px;
}
.turn-input:focus {
    outline: none;
    border-color: #3b82f6;
}
.working-label {
    font-size: 16px;
    font-weight: bold;
    color: #d97706;
    padding: 0 12px;
}
.update-banner {
    background: #10b981;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-top: 16px;
    text-align: center;
    font-weight: 600;
}
.update-banner a {
    color: white;
    text-decoration: underline;
    font-weight: bold;
}
.dropdown {
    position: relative;
    display: inline-block;
}
.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border-radius: 8px;
    z-index: 1000;
    right: 0;
    top: 100%;
    margin-top: 8px;
}
.dropdown-content.show {
    display: block;
}
.dropdown-content button {
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 14px;
    color: #1f2937;
}
.dropdown-content button:hover {
    background: #f3f4f6;
}
.dropdown-content button:first-child {
    border-radius: 8px 8px 0 0;
}
.dropdown-content button:last-child {
    border-radius: 0 0 8px 8px;
}
.page {
    display: none;
}
.page.active {
    display: block;
}
.employee-info-card {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.employee-info-card .info {
    flex: 1;
}
.employee-info-card h3 {
    color: #1f2937;
    margin-bottom: 8px;
    font-size: 18px;
}
.employee-info-card p {
    color: #6b7280;
    margin: 4px 0;
}
.employee-info-card .actions {
    display: flex;
    gap: 8px;
}
.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-weight: 600;
}
.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
}
.form-group input:focus {
    outline: none;
    border-color: #3b82f6;
}
.date-inputs {
    display: flex;
    gap: 12px;
}
.date-inputs input {
    flex: 1;
}
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal.show {
    display: flex;
}
.modal-content {
    background: white;
    padding: 24px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
}
.modal-content h3 {
    margin-bottom: 16px;
    font-size: 20px;
    color: #1f2937;
}
.modal-content p {
    margin-bottom: 12px;
    color: #6b7280;
    line-height: 1.5;
}
.modal-content input {
    width: 100%;
    padding: 12px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 16px;
}
.modal-content input:focus {
    outline: none;
    border-color: #3b82f6;
}
.modal-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.btn-secondary {
    background: #e5e7eb;
    color: #1f2937;
}
.btn-secondary:hover {
    background: #d1d5db;
}
.setup-card {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
}
.setup-card h2 {
    color: #92400e;
    margin-bottom: 16px;
    font-size: 22px;
}
.setup-card h3 {
    color: #78350f;
    margin-top: 16px;
    margin-bottom: 8px;
    font-size: 18px;
}
.setup-card p, .setup-card li {
    color: #78350f;
    margin-bottom: 8px;
    line-height: 1.6;
}
.setup-card code {
    background: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #dc2626;
}
.setup-card ol {
    margin-left: 24px;
    margin-top: 12px;
}
.setup-card li {
    margin-bottom: 12px;
}
.setup-card strong {
    color: #92400e;
}
.setup-card a {
    color: #2563eb;
    text-decoration: underline;
}
.code-block {
    background: #1f2937;
    color: #e5e7eb;
    padding: 16px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    overflow-x: auto;
    margin: 12px 0;
    line-height: 1.5;
}
.warning-box {
    background: #fef2f2;
    border: 2px solid #fca5a5;
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
}
.warning-box p {
    color: #991b1b;
    margin: 0;
}

/* Audit Log Styles */
.audit-log-item {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}
.audit-log-item.add { border-left: 4px solid #10b981; }
.audit-log-item.edit { border-left: 4px solid #3b82f6; }
.audit-log-item.delete { border-left: 4px solid #ef4444; }
.audit-log-item.hide { border-left: 4px solid #f59e0b; }
.audit-log-item.turn { border-left: 4px solid #8b5cf6; }
.audit-log-item.working { border-left: 4px solid #f59e0b; }
.audit-log-item.done { border-left: 4px solid #10b981; }
.audit-log-item.clear { border-left: 4px solid #6b7280; }
.audit-log-item.reorder { border-left: 4px solid #06b6d4; }

.audit-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.audit-log-action {
    font-weight: 600;
    color: #1f2937;
    font-size: 16px;
}
.audit-log-time {
    color: #6b7280;
    font-size: 13px;
}
.audit-log-details {
    color: #4b5563;
    font-size: 14px;
    line-height: 1.5;
}
.filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.filter-btn {
    padding: 6px 12px;
    font-size: 13px;
    background: #e5e7eb;
    color: #1f2937;
}
.filter-btn.active {
    background: #3b82f6;
    color: white;
}
.passcode-input {
    text-align: center;
    font-size: 24px;
    letter-spacing: 8px;
    font-weight: bold;
}
.error-message {
    color: #ef4444;
    font-size: 14px;
    margin-top: 8px;
    text-align: center;
}

/* Timer Styles */
.timer-display {
    font-size: 20px;
    font-weight: bold;
    color: #3b82f6;
    min-width: 80px;
    text-align: center;
}
.timer-display.warning {
    color: #f59e0b;
}
.timer-display.danger {
    color: #ef4444;
    animation: blink 1s infinite;
}
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.5; }
}

/* History Styles */
.history-item {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid #10b981;
}
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.history-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 18px;
}
.history-date {
    color: #6b7280;
    font-size: 14px;
}
.history-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    color: #4b5563;
    font-size: 14px;
}
.history-detail {
    display: flex;
    align-items: center;
    gap: 4px;
}
.history-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.date-filter {
    padding: 8px 12px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
}

/* Settings/Toggle Styles */
.settings-section {
    background: #f3f4f6;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}
.settings-section h3 {
    font-size: 16px;
    color: #1f2937;
    margin-bottom: 12px;
}
.toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
}
.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #374151;
    font-weight: 500;
}
.toggle-switch {
    position: relative;
    width: 50px;
    height: 28px;
    background-color: #d1d5db;
    border-radius: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
}
.toggle-switch.active {
    background-color: #10b981;
}
.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}
.toggle-switch.active .toggle-slider {
    transform: translateX(22px);
}
.toggle-switch.disabled {
    background-color: #e5e7eb;
    cursor: not-allowed;
    opacity: 0.5;
}
.toggle-switch.disabled .toggle-slider {
    background-color: #d1d5db;
}
