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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f7;
    color: #1d1d1f;
    min-height: 100vh;
}

#app {
    max-width: 680px;
    margin: 0 auto;
    padding: 20px;
}

.screen { display: none; }
.screen.active { display: block; }
.hidden { display: none !important; }

/* Code Entry */
#code-entry {
    text-align: center;
    padding-top: 15vh;
}

.logo-section { margin-bottom: 40px; }
.logo-icon { font-size: 64px; margin-bottom: 12px; }
.logo-section h1 { font-size: 28px; font-weight: 700; }
.subtitle { color: #86868b; margin-top: 4px; font-size: 16px; }

.code-form {
    max-width: 360px;
    margin: 0 auto;
}

.code-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #86868b;
    margin-bottom: 8px;
}

.code-form input {
    width: 100%;
    padding: 16px;
    font-size: 24px;
    font-family: 'SF Mono', monospace;
    text-align: center;
    letter-spacing: 4px;
    border: 2px solid #d2d2d7;
    border-radius: 12px;
    outline: none;
    text-transform: uppercase;
    transition: border-color 0.2s;
}

.code-form input:focus { border-color: #0071e3; }

.code-form button {
    width: 100%;
    padding: 14px;
    margin-top: 16px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: #0071e3;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.code-form button:hover { background: #0077ed; }
.code-form button:disabled { background: #d2d2d7; cursor: not-allowed; }

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.error {
    color: #ff3b30;
    font-size: 14px;
    margin-top: 12px;
}

.help-text {
    color: #86868b;
    font-size: 13px;
    margin-top: 16px;
}

/* Data Display */
header {
    text-align: center;
    padding: 24px 0 16px;
}

header h2 { font-size: 24px; font-weight: 700; }

.org-name {
    font-size: 15px;
    color: #86868b;
    margin-top: 4px;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 8px;
    background: #e8f5e9;
    color: #2e7d32;
}

.sign-out-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 6px 16px;
    font-size: 13px;
    color: #ff3b30;
    background: none;
    border: 1px solid #ff3b30;
    border-radius: 8px;
    cursor: pointer;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 0;
    margin-bottom: 16px;
}

.tab {
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 20px;
    background: #e8e8ed;
    color: #1d1d1f;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab.active { background: #0071e3; color: #fff; }
.tab:hover:not(.active) { background: #d2d2d7; }

/* Tab Content */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Cards */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f7;
}

.card-row:last-child { border-bottom: none; }
.card-label { color: #86868b; font-size: 14px; min-width: 110px; }
.card-value { font-size: 14px; font-weight: 500; text-align: right; }

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

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

.status-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.status-paid { background: #e8f5e9; color: #2e7d32; }
.status-unpaid, .status-pending { background: #fff3e0; color: #e65100; }
.status-overdue { background: #ffebee; color: #c62828; }

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #86868b;
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

footer {
    text-align: center;
    padding: 24px 0;
    color: #86868b;
    font-size: 12px;
}

/* PTO Balances */
.pto-balance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.pto-balance-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.pto-balance-type {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    color: #86868b;
    margin-bottom: 8px;
}

.pto-balance-remaining {
    font-size: 28px;
    font-weight: 700;
    color: #0071e3;
}

.pto-balance-remaining span {
    font-size: 13px;
    font-weight: 500;
    color: #86868b;
}

.pto-balance-detail {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #86868b;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f5f5f7;
}

/* PTO Status Badges */
.status-approved { background: #e8f5e9; color: #2e7d32; }
.status-rejected { background: #ffebee; color: #c62828; }

/* PTO Request Form */
.section-subtitle {
    font-size: 16px;
    font-weight: 600;
    margin: 24px 0 12px;
}

.pto-form .form-group {
    margin-bottom: 14px;
}

.pto-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #86868b;
    margin-bottom: 6px;
}

.pto-form select,
.pto-form input[type="date"],
.pto-form input[type="number"],
.pto-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background: inherit;
    color: inherit;
}

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

.pto-submit-btn {
    width: 100%;
    padding: 12px;
    margin-top: 4px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: #0071e3;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.pto-submit-btn:hover { background: #0077ed; }
.pto-submit-btn:disabled { background: #d2d2d7; cursor: not-allowed; }

.pto-feedback {
    font-size: 14px;
    margin-top: 12px;
    text-align: center;
}

.pto-feedback.success {
    color: #2e7d32;
}

/* Pending PTO Requests */
.pto-pending-section {
    margin-top: 20px;
}

/* Org Picker */
.org-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: box-shadow 0.2s;
}

.org-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.org-card-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.org-card-name {
    font-size: 16px;
    font-weight: 600;
    flex-grow: 1;
}

.org-card-arrow {
    color: #86868b;
    font-size: 18px;
}

.org-back-btn {
    display: block;
    margin: 20px auto 0;
    padding: 10px 32px;
    font-size: 14px;
    color: #0071e3;
    background: none;
    border: 1px solid #0071e3;
    border-radius: 10px;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 480px) {
    #app { padding: 12px; }
    #code-entry { padding-top: 10vh; }
    .logo-icon { font-size: 48px; }
    .logo-section h1 { font-size: 22px; }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    body { background: #1c1c1e; color: #f5f5f7; }
    .code-form input { background: #2c2c2e; border-color: #48484a; color: #f5f5f7; }
    .code-form input:focus { border-color: #0a84ff; }
    .code-form button { background: #0a84ff; }
    .tab { background: #2c2c2e; color: #f5f5f7; }
    .tab.active { background: #0a84ff; }
    .tab:hover:not(.active) { background: #3a3a3c; }
    .card { background: #2c2c2e; }
    .card-row { border-color: #3a3a3c; }
    .card-label { color: #98989d; }
    .pto-balance-card { background: #2c2c2e; }
    .pto-balance-remaining { color: #0a84ff; }
    .pto-balance-detail { border-color: #3a3a3c; }
    .pto-form select,
    .pto-form input[type="date"],
    .pto-form input[type="number"],
    .pto-form textarea { background: #1c1c1e; border-color: #48484a; color: #f5f5f7; }
    .pto-submit-btn { background: #0a84ff; }
    .org-card { background: #2c2c2e; }
    .org-back-btn { color: #0a84ff; border-color: #0a84ff; }
}
