:root {
    --primary: #007AFF;
    --primary-dark: #0056CC;
    --primary-light: #E5F2FF;
    --primary-bg: rgba(0, 122, 255, 0.1);
    --bg-main: #F2F2F7;
    --bg-white: #FFFFFF;
    --bg-secondary: #F9F9FB;
    --text-primary: #1C1C1E;
    --text-secondary: #8E8E93;
    --text-muted: #C7C7CC;
    --border: #E5E5EA;
    --border-light: rgba(0, 0, 0, 0.04);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.12);
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-top: env(safe-area-inset-top, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.auth-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    padding-top: calc(24px + var(--safe-area-top));
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg-main) 100%);
}

.auth-card {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    width: 64px;
    height: 64px;
    background: var(--primary-light);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.auth-logo svg {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.auth-title {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.auth-subtitle {
    text-align: center;
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 3px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab.active {
    background: var(--bg-white);
    color: var(--primary);
    box-shadow: var(--shadow);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 16px;
}

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

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

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: end;
}

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

.code-btn {
    padding: 14px 16px;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    min-width: 100px;
}

.code-btn:active {
    transform: scale(0.96);
}

.code-btn:disabled {
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
}

.auth-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.auth-btn:active {
    transform: scale(0.98);
    background: var(--primary-dark);
}

.forgot-link {
    display: block;
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--primary);
    text-decoration: none;
    padding: 8px;
}

.app-container {
    display: none;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

.letter-app {
    display: none;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

.letter-app.active {
    display: flex;
}

.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    padding: 12px 16px;
    padding-top: calc(12px + var(--safe-area-top));
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.9);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo {
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-logo svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.header-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-email {
    font-size: 13px;
    color: var(--text-secondary);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-btn {
    padding: 8px 12px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:active {
    background: var(--border);
}

.main-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(80px + var(--safe-area-bottom));
}

.page-section {
    padding: 16px;
}

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

.section-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn:active {
    transform: scale(0.96);
}

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

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-secondary:active {
    background: var(--border);
}

.btn-danger {
    background: rgba(255, 59, 48, 0.1);
    color: #FF3B30;
}

.btn-danger:active {
    background: rgba(255, 59, 48, 0.2);
}

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

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
}

.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.schedule-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-light);
}

.schedule-card:active {
    transform: scale(0.98);
    background: var(--bg-secondary);
}

.schedule-card.current {
    border-color: var(--primary);
    background: var(--primary-light);
}

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

.schedule-name {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.schedule-badge {
    padding: 4px 10px;
    background: var(--primary);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.schedule-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.schedule-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.action-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.action-btn:active {
    transform: scale(0.96);
}

.action-btn.primary {
    background: var(--primary-light);
    color: var(--primary);
}

.action-btn.secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.action-btn.danger {
    background: rgba(255, 59, 48, 0.1);
    color: #FF3B30;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
}

.empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    color: var(--text-muted);
    opacity: 0.6;
}

.empty-text {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.empty-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    padding-bottom: calc(8px + var(--safe-area-bottom));
    z-index: 100;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px 16px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    min-width: 64px;
}

.tab-item svg {
    width: 24px;
    height: 24px;
}

.tab-item span {
    font-size: 10px;
    font-weight: 500;
}

.tab-item.active {
    color: var(--primary);
}

.tab-item:active {
    opacity: 0.6;
}

.fab {
    position: fixed;
    right: 20px;
    bottom: calc(100px + var(--safe-area-bottom));
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 50;
}

.fab:active {
    transform: scale(0.9);
}

.fab svg {
    width: 24px;
    height: 24px;
}

.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-main);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.fullscreen-modal.show {
    display: flex;
    transform: translateX(0);
}

.fullscreen-modal form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.modal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: calc(12px + var(--safe-area-top));
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-nav-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-back-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    margin-left: -8px;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 17px;
    cursor: pointer;
}

.nav-back-btn svg {
    width: 20px;
    height: 20px;
}

.modal-nav-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-nav-right {
    min-width: 60px;
    display: flex;
    justify-content: flex-end;
}

.nav-save-btn {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.nav-save-btn:active {
    background: var(--primary-dark);
}

.nav-action-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

.nav-action-btn:active {
    background: var(--border);
}

.nav-action-btn svg {
    width: 18px;
    height: 18px;
}

.modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 16px;
    padding-bottom: calc(16px + var(--safe-area-bottom));
}

.form-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
}

.form-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.form-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.form-grid .form-group {
    margin-bottom: 0;
}

.time-slots-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
}

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

.time-slot-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.time-slot-card:active {
    background: var(--border);
}

.time-slot-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.time-slot-node {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary);
    min-width: 45px;
}

.time-slot-time {
    font-size: 15px;
    color: var(--text-primary);
}

.time-slot-edit-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.courses-section {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
}

.course-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.course-item {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 14px;
}

.course-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.course-item-header .form-input {
    flex: 1;
    padding: 10px 12px;
    font-size: 15px;
}

.course-color-input {
    width: 44px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.course-schedules {
    margin-top: 12px;
}

.schedule-time-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-white);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.schedule-time-card:active {
    background: var(--bg-secondary);
}

.schedule-time-info {
    flex: 1;
}

.schedule-time-main {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.schedule-time-detail {
    font-size: 13px;
    color: var(--text-secondary);
}

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

.schedule-time-actions .btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
}

.schedule-time-actions .btn svg {
    width: 16px;
    height: 16px;
}

.add-schedule-btn {
    width: 100%;
    padding: 12px;
    background: var(--bg-white);
    color: var(--primary);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.add-schedule-btn:active {
    background: var(--bg-secondary);
    border-color: var(--primary);
}

.add-schedule-btn svg {
    width: 16px;
    height: 16px;
}

.add-course-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.add-course-btn svg {
    width: 20px;
    height: 20px;
}

.add-course-btn:active {
    background: var(--primary-bg);
}

.bottom-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.bottom-modal.show {
    display: flex;
}

.bottom-modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--safe-area-bottom);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.bottom-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: var(--bg-white);
}

.bottom-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.bottom-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary);
}

.bottom-modal-close svg {
    width: 18px;
    height: 18px;
}

.bottom-modal-body {
    padding: 20px;
}

.bottom-modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    position: sticky;
    bottom: 0;
    background: var(--bg-white);
}

.bottom-modal-footer .btn {
    flex: 1;
    padding: 14px;
    font-size: 16px;
}

.import-tabs {
    display: flex;
    margin-bottom: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 3px;
}

.import-tab {
    flex: 1;
    padding: 10px 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.import-tab.active {
    background: var(--bg-white);
    color: var(--primary);
    box-shadow: var(--shadow);
}

.import-form {
    display: none;
}

.import-form.active {
    display: block;
}

.file-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    background: var(--bg-secondary);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-upload-area:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-upload-area svg {
    width: 32px;
    height: 32px;
    color: var(--primary);
    margin-bottom: 12px;
}

.file-upload-area span {
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
}

.toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 40px);
    box-shadow: var(--shadow-lg);
}

.toast svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--bg-white);
    color: var(--text-primary);
}

.toast.error {
    background: #FF3B30;
    color: white;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

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

.loading-container {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.saved-credential-container {
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.saved-credential-container.expired {
    background: #FFF3E0;
    border-color: #FF9800;
}

.saved-credential-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
}

.saved-credential-container.expired .saved-credential-header {
    color: #FF9800;
}

.saved-credential-header svg {
    width: 18px;
    height: 18px;
}

.saved-credential-info {
    margin-bottom: 12px;
}

.saved-credential-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.saved-credential-code {
    font-size: 13px;
    color: var(--text-secondary);
}

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

.saved-credential-actions .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    font-size: 14px;
}

.saved-credential-actions .btn svg {
    width: 16px;
    height: 16px;
}

.qrcode-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
}

.qrcode-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.qrcode-header svg {
    width: 20px;
    height: 20px;
}

.qrcode-image-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.qrcode-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qrcode-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.qrcode-placeholder svg {
    width: 80px;
    height: 80px;
    color: var(--text-muted);
    opacity: 0.5;
}

.qrcode-status {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
}

.qrcode-status-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qrcode-status-icon svg {
    width: 48px;
    height: 48px;
}

.qrcode-status-text {
    text-align: center;
}

.qrcode-status-text .status-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.qrcode-status-text .status-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.qrcode-image-wrapper.scanned .qrcode-status-icon svg {
    color: var(--primary);
}

.qrcode-image-wrapper.success .qrcode-status-icon svg,
.qrcode-image-wrapper.imported .qrcode-status-icon svg {
    color: #34C759;
}

.qrcode-image-wrapper.expired .qrcode-status-icon svg {
    color: #FF9500;
}

.qrcode-image-wrapper.error .qrcode-status-icon svg {
    color: #FF3B30;
}

.qrcode-image-wrapper.loading .qrcode-status-icon svg {
    color: var(--primary);
    animation: spin 1s linear infinite;
}

.qrcode-actions {
    margin-top: 16px;
}

.qrcode-actions .btn {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qrcode-actions .btn svg {
    width: 16px;
    height: 16px;
}

.qrcode-timer {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.qrcode-timer span {
    font-weight: 600;
    color: var(--primary);
}

@media (min-width: 768px) {
    .auth-card {
        max-width: 420px;
    }
    
    .form-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .time-slots-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .course-schedule-item {
        flex-wrap: nowrap;
    }
    
    .letter-app {
        flex-direction: row;
    }
    
    .letter-app .header {
        display: none;
    }
    
    .letter-app .main-content {
        margin-left: 240px;
        flex: 1;
        padding: 24px;
        max-width: calc(100% - 240px);
    }
}

@media (max-width: 374px) {
    .auth-title {
        font-size: 22px;
    }
    
    .section-title {
        font-size: 18px;
    }
    
    .schedule-name {
        font-size: 15px;
    }
}

.profile-header {
    background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg-main) 100%);
    padding: 40px 20px;
    margin: -16px -16px 24px -16px;
    text-align: center;
}

.profile-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.profile-nickname {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.profile-email {
    font-size: 14px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.6);
    padding: 6px 14px;
    border-radius: 20px;
}

.settings-group {
    margin-bottom: 28px;
}

.settings-group:last-child {
    margin-bottom: 16px;
}

.settings-group-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0 4px 10px;
}

.settings-list {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
}

.settings-item::after {
    content: '';
    position: absolute;
    left: 52px;
    right: 18px;
    bottom: 0;
    height: 1px;
    background: var(--border-light);
}

.settings-item:last-child::after {
    display: none;
}

.settings-item:active {
    background: var(--bg-secondary);
}

.settings-item-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.settings-item-left svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
    flex-shrink: 0;
    padding: 6px;
    background: var(--primary-light);
    border-radius: 8px;
}

.settings-item-left span {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 500;
}

.settings-item-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-value {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-arrow {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.settings-item.danger .settings-item-left svg {
    color: #FF3B30;
    background: rgba(255, 59, 48, 0.1);
}

.settings-item.danger .settings-item-left span {
    color: #FF3B30;
}

.settings-item.danger:active {
    background: rgba(255, 59, 48, 0.05);
}

.sidebar {
    display: none;
}

.sidebar::-webkit-scrollbar,
.sidebar-nav::-webkit-scrollbar,
.sidebar *::-webkit-scrollbar {
    display: none;
}

.sidebar,
.sidebar-nav {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

@media (min-width: 768px) {
    .sidebar {
        display: flex;
        flex-direction: column;
        width: 240px;
        min-width: 240px;
        background: var(--bg-white);
        border-right: 1px solid var(--border-light);
        height: 100vh;
        position: fixed;
        left: 0;
        top: 0;
        z-index: 100;
    }

    .sidebar-header {
        padding: 24px 20px;
        border-bottom: 1px solid var(--border-light);
    }

    .sidebar-logo {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .sidebar-logo svg {
        width: 32px;
        height: 32px;
        color: var(--primary);
    }

    .sidebar-title {
        font-size: 18px;
        font-weight: 600;
        color: var(--text-primary);
    }

    .sidebar-nav {
        flex: 1;
        padding: 16px 12px;
        overflow-y: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .sidebar-nav-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        border-radius: var(--radius);
        font-size: 15px;
        color: var(--text-secondary);
        cursor: pointer;
        transition: all 0.2s ease;
        margin-bottom: 4px;
        text-decoration: none;
    }

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

    .sidebar-nav-item.active {
        background: var(--primary-light);
        color: var(--primary);
        font-weight: 500;
    }

    .sidebar-nav-item svg {
        width: 20px;
        height: 20px;
    }

    .sidebar-footer {
        padding: 16px 12px;
        border-top: 1px solid var(--border-light);
    }

    .sidebar-user {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px;
    }

    .sidebar-user-avatar {
        width: 36px;
        height: 36px;
        background: var(--primary-light);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        font-weight: 600;
        color: var(--primary);
    }

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

    .sidebar-user-name {
        font-size: 14px;
        font-weight: 500;
        color: var(--text-primary);
    }

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