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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #059669;
    --success-light: #d1fae5;
    --error: #dc2626;
    --error-light: #fee2e2;
    --text: #1e293b;
    --text-muted: #64748b;
    --bg: #f1f5f9;
    --card: #ffffff;
    --border: #e2e8f0;
    --radius: 8px;
}

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

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

.header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 24px 0;
}
.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}
.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.logo {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
}
.lang-btn {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    transition: border-color 0.15s, background 0.15s;
}
.lang-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}
.subtitle {
    color: var(--text-muted);
    margin-top: 4px;
}

.main {
    flex: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 20px;
    width: 100%;
}

.week-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
}
.nav-btn {
    width: 40px; height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text);
    display: flex; align-items: center; justify-content: center;
    transition: border-color 0.15s, background 0.15s;
}
.nav-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.week-label {
    font-weight: 600;
    font-size: 1rem;
    min-width: 200px;
    text-align: center;
}

.week-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.day-column {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.day-column.today {
    border-color: var(--primary);
}
.day-column.today .day-header {
    background: var(--primary);
    color: #fff;
}

.day-header {
    background: var(--bg);
    padding: 10px 8px;
    text-align: center;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
}
.day-name { font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.day-num { font-size: 1.2rem; font-weight: 700; }
.day-month { font-size: 0.75rem; opacity: 0.7; }

.day-slots {
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 520px;
    overflow-y: auto;
}

.slot {
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: 'SF Mono', 'Menlo', monospace;
    text-align: center;
    transition: all 0.12s;
}
.slot.available {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 500;
}
.slot.available:hover {
    border-color: var(--success);
    transform: scale(1.02);
}
.slot.taken {
    background: transparent;
    color: var(--text-muted);
    opacity: 0.4;
    border: 1px solid transparent;
    cursor: default;
}

.no-slots, .loading-dots {
    text-align: center;
    color: var(--text-muted);
    padding: 20px 0;
    font-size: 0.9rem;
}

.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--card);
    border-radius: 12px;
    padding: 28px;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    animation: slideUp 0.2s;
}
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-title {
    font-size: 1.1rem;
    margin-bottom: 8px;
}
.modal-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 20px;
}

.field { margin-bottom: 14px; }
.field-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-muted);
}
.field-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s;
}
.field-input:focus { border-color: var(--primary); }

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn {
    padding: 9px 20px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}
.btn-cancel {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-cancel:hover { background: var(--bg); }

.check {
    width: 56px; height: 56px;
    background: var(--success-light);
    color: var(--success);
    font-size: 1.8rem;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    font-weight: 700;
}

.modal-success { text-align: center; }
.modal-error { text-align: center; }

.meet-box {
    margin: 16px 0;
    padding: 12px;
    background: var(--primary-light);
    border-radius: var(--radius);
    word-break: break-all;
}
.meet-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.meet-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.85rem;
}
.meet-link:hover { text-decoration: underline; }

.error-text {
    color: var(--error);
    margin: 12px 0;
}

.footer {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    background: var(--card);
}

@media (max-width: 768px) {
    .week-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .day-slots {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }
    .day-header {
        justify-content: flex-start;
        gap: 10px;
    }
}
