/* ============================================================
   HR Manager - Main Stylesheet
   ============================================================ */

/* CSS Variables */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #eff6ff;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: #334155;
    --bg-sidebar-active: #3b82f6;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-white: #ffffff;

    --border: #e2e8f0;
    --border-focus: #3b82f6;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);

    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 4px;

    --transition: all 0.2s ease;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
    font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    background: var(--bg-body);
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

.hidden { display: none !important; }

/* ============================================================
   Utility Classes
   ============================================================ */
.text-muted { color: var(--text-muted); font-size: 0.85rem; }
.text-red { color: var(--danger); }
.text-blue { color: var(--primary); }
.text-blue-dark { color: var(--primary-dark); }

/* ============================================================
   Toast Notifications
   ============================================================ */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: slideInRight 0.3s ease;
    min-width: 260px;
}

.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-info { background: var(--primary); color: white; }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    border: 2px solid transparent;
    transition: var(--transition);
    white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

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

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}
.btn-danger:hover { background: #dc2626; }

.btn-edit {
    color: var(--warning);
    border-color: var(--warning);
}
.btn-edit:hover { background: #fffbeb; }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; border-radius: 6px; }
.btn-full { width: 100%; justify-content: center; padding: 13px; }

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================
   Alerts
   ============================================================ */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 16px;
}
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #7c3aed 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-container {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.login-card {
    width: 100%;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.8rem;
    color: white;
}

.login-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.login-form .form-group {
    margin-bottom: 18px;
}

.login-form label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-form input {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.login-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input { padding-right: 44px; }

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 4px;
}
.toggle-password:hover { color: var(--text-primary); }

.login-demo-info {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
}

.demo-title {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 500;
}

.demo-accounts { display: flex; flex-direction: column; gap: 8px; }

.demo-account {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
    border: 1px solid var(--border);
}
.demo-account:hover { border-color: var(--primary); background: var(--primary-light); }

.login-footer {
    color: rgba(255,255,255,0.6);
    font-size: 0.78rem;
    text-align: center;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-page {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
}

.sidebar-logo i {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 4px 8px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: rgba(255,255,255,0.65);
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 4px;
}

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

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.05);
}

.user-avatar {
    font-size: 1.5rem;
    color: rgba(255,255,255,0.5);
}

.user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 0.87rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: rgba(255,255,255,0.55);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}
.btn-logout:hover { background: rgba(239,68,68,0.15); color: #fca5a5; border-color: rgba(239,68,68,0.3); }

/* Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* Main Wrapper */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Header */
.app-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-secondary);
    padding: 6px 8px;
    border-radius: 6px;
}
.menu-toggle:hover { background: var(--bg-body); }

.header-title { flex: 1; }
.header-title h2 { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }

.header-user {
    font-size: 0.82rem;
    color: var(--text-muted);
    background: var(--bg-body);
    padding: 4px 12px;
    border-radius: 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 24px;
    max-width: 1400px;
    width: 100%;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i { color: var(--primary); }

.card-body { padding: 24px; }

/* ============================================================
   Stats Grid
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
    flex-shrink: 0;
}

.stat-card-blue .stat-icon { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-card-green .stat-icon { background: linear-gradient(135deg, #10b981, #059669); }
.stat-card-purple .stat-icon { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-card-orange .stat-icon { background: linear-gradient(135deg, #f59e0b, #d97706); }

.stat-info { display: flex; flex-direction: column; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 1.7rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }

/* ============================================================
   Charts Grid
   ============================================================ */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-container {
    height: 280px;
    position: relative;
}

/* ============================================================
   Tables
   ============================================================ */
.table-responsive { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table th {
    background: var(--bg-body);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--primary-light); }

.clickable-row { cursor: pointer; }

/* Employee Name Cell */
.employee-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.emp-fullname { font-weight: 600; }
.emp-kana { font-size: 0.75rem; color: var(--text-muted); }

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-admin { background: #fef3c7; color: #d97706; }
.badge-user  { background: var(--primary-light); color: var(--primary); }
.badge-optional { background: #f1f5f9; color: var(--text-muted); font-size: 0.7rem; padding: 2px 8px; border-radius: 10px; }
.ai-status-badge { background: #d1fae5; color: #065f46; font-size: 0.75rem; padding: 3px 10px; border-radius: 20px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

.gender-badge-male    { background: #dbeafe; color: #2563eb; padding: 4px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.gender-badge-female  { background: #fce7f3; color: #be185d; padding: 4px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.gender-badge-other   { background: #f3e8ff; color: #7c3aed; padding: 4px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.gender-badge-unknown { background: #f1f5f9; color: var(--text-muted); padding: 4px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }

.qual-badge {
    display: inline-block;
    background: #eff6ff;
    color: var(--primary);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    margin: 2px;
}
.qual-badge.more { background: #f1f5f9; color: var(--text-muted); }

.qual-badge-lg {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    margin: 4px 4px 4px 0;
}

.age-badge {
    background: #f0fdf4;
    color: #16a34a;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* ============================================================
   Filter Bar
   ============================================================ */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 220px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-box input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    outline: none;
    transition: var(--transition);
}
.search-box input:focus { border-color: var(--primary); }

.filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-group select {
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    outline: none;
    background: white;
    cursor: pointer;
    transition: var(--transition);
}
.filter-group select:focus { border-color: var(--primary); }

.results-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.results-info span { color: var(--text-primary); font-weight: 600; }

/* ============================================================
   Action Buttons
   ============================================================ */
.action-btns {
    display: flex;
    gap: 6px;
}

.qualifications-cell {
    max-width: 180px;
    display: flex;
    flex-wrap: wrap;
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 0 0;
}

.page-btn {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border);
    background: white;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   Forms
   ============================================================ */
.form-section {
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px dashed var(--border);
}
.form-section:last-of-type { border-bottom: none; }

.section-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-light);
}
.section-title i { color: var(--primary); }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group-full { grid-column: 1 / -1; }

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group label.required::after {
    content: ' *';
    color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
    background: white;
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.form-group textarea { resize: vertical; min-height: 80px; }

.postal-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}
.postal-input-group input { flex: 1; }

/* Qualification Input */
.qualifications-input {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.qual-input-row {
    display: flex;
    gap: 8px;
}
.qual-input-row input { flex: 1; }

.qualifications-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 36px;
    padding: 8px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
}

.qual-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-light);
    color: var(--primary);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
}
.qual-tag button {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.7rem;
    padding: 0;
    line-height: 1;
    opacity: 0.6;
}
.qual-tag button:hover { opacity: 1; }

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 8px;
}

/* ============================================================
   File Upload
   ============================================================ */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    transition: var(--transition);
}

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

.upload-placeholder {
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.upload-icon {
    font-size: 3rem;
    color: var(--text-muted);
}

.upload-text {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.upload-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.upload-preview { padding: 20px; }

.file-preview-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 12px;
}

.file-preview-icon { font-size: 2rem; }
.file-preview-icon .fa-file-pdf { color: var(--danger); }
.file-preview-icon .fa-file-image { color: var(--primary); }

.file-preview-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.file-name { font-weight: 600; font-size: 0.9rem; }
.file-size { font-size: 0.78rem; color: var(--text-muted); }

.upload-note {
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.upload-note i { color: var(--primary); }

/* ============================================================
   Employee Detail
   ============================================================ */
.profile-header-card {
    background: white;
    border-radius: var(--radius);
    padding: 28px 32px;
    display: flex;
    align-items: center;
    gap: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-avatar-large span {
    font-size: 2.2rem;
    font-weight: 800;
    color: white;
}

.profile-header-info { flex: 1; }
.profile-header-info h2 { font-size: 1.5rem; font-weight: 800; }
.profile-kana { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }
.profile-badges { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.profile-badge-id { font-size: 0.72rem; color: var(--text-muted); background: var(--bg-body); padding: 3px 8px; border-radius: 6px; }

.profile-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.detail-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.detail-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    gap: 16px;
}
.detail-item:last-child { border-bottom: none; }
.detail-item-vertical { flex-direction: column; align-items: flex-start; gap: 8px; }

.detail-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 120px;
    flex-shrink: 0;
}
.detail-label i { color: var(--primary); width: 14px; text-align: center; }

.detail-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
    word-break: break-all;
}

.notes-value {
    white-space: pre-wrap;
    line-height: 1.6;
    background: var(--bg-body);
    padding: 10px;
    border-radius: var(--radius-xs);
    font-size: 0.85rem;
    width: 100%;
}

.resume-image-preview {
    max-width: 100%;
    max-height: 600px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.resume-file-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-body);
    border-radius: var(--radius-sm);
}

.file-name-display {
    font-weight: 600;
    font-size: 0.95rem;
}

.back-nav { margin-bottom: 24px; }

/* ============================================================
   State displays
   ============================================================ */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.loading-spinner i { font-size: 1.5rem; margin-bottom: 8px; display: block; }

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.empty-state i { font-size: 2rem; margin-bottom: 10px; display: block; }

.error-state {
    text-align: center;
    padding: 40px;
    color: var(--danger);
    font-size: 0.9rem;
}

.error-card {
    text-align: center;
    padding: 60px 40px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.error-card i { font-size: 3rem; color: var(--warning); margin-bottom: 16px; display: block; }
.error-card h3 { margin-bottom: 20px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-close { display: block; }
    .sidebar-overlay.show { display: block; }

    .main-wrapper { margin-left: 0; }
    .menu-toggle { display: block; }

    .stats-grid { grid-template-columns: 1fr 1fr; }

    .main-content { padding: 16px; }

    .form-row { grid-template-columns: 1fr; }

    .profile-header-card { flex-direction: column; text-align: center; }
    .profile-badges { justify-content: center; }
    .profile-header-actions { justify-content: center; }

    .filter-bar { flex-direction: column; align-items: stretch; }
    .search-box { min-width: unset; }

    .data-table th:nth-child(3),
    .data-table td:nth-child(3),
    .data-table th:nth-child(4),
    .data-table td:nth-child(4) { display: none; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-card { padding: 28px 24px; }
    .charts-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Sidebar: nav section label & password-change button
   ============================================================ */
.nav-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 12px 14px 4px;
    margin-top: 8px;
}

.btn-change-pw {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 14px;
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: rgba(255,255,255,0.55);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 6px;
    cursor: pointer;
    text-decoration: none;
}
.btn-change-pw:hover { background: rgba(59,130,246,0.15); color: #93c5fd; border-color: rgba(59,130,246,0.3); }

/* ============================================================
   OCR Panel
   ============================================================ */
.ocr-progress-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: #f8faff;
    border: 1px solid #c7d9ff;
    border-radius: var(--radius-sm);
    margin-top: 12px;
}

.ocr-progress-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary);
}

.ocr-spin {
    animation: spin 1.5s linear infinite;
}

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

.ocr-progress-track {
    height: 8px;
    background: #dbeafe;
    border-radius: 99px;
    overflow: hidden;
}

.ocr-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 99px;
    transition: width 0.3s ease;
}

/* OCR result panel */
.ocr-result-panel {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    border-radius: var(--radius-sm);
    margin-top: 12px;
    overflow: hidden;
}

.ocr-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #bbf7d0;
    flex-wrap: wrap;
    gap: 8px;
}

.ocr-result-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #16a34a;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ocr-result-actions { display: flex; gap: 8px; }

.ocr-result-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0;
    padding: 8px 16px 12px;
}

.ocr-preview-row {
    display: flex;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px dashed #d1fae5;
    font-size: 0.85rem;
}
.ocr-preview-row:last-child { border-bottom: none; }

.ocr-preview-label {
    font-weight: 600;
    color: #15803d;
    min-width: 130px;
    flex-shrink: 0;
    font-size: 0.78rem;
}

.ocr-preview-value {
    color: var(--text-primary);
    word-break: break-all;
}

.ocr-result-note {
    padding: 8px 16px;
    font-size: 0.78rem;
    color: #4d7c0f;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #dcfce7;
    border-top: 1px solid #bbf7d0;
}

/* OCR error panel */
.ocr-error-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: var(--radius-sm);
    margin-top: 12px;
    font-size: 0.85rem;
    color: #c2410c;
    flex-wrap: wrap;
}

.ocr-error-panel i { font-size: 1rem; }

.text-success { color: var(--success); }

/* ============================================================
   Modal
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.2s ease;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.modal-header h3 i { color: var(--primary); }

.modal-close {
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 6px;
    transition: var(--transition);
}
.modal-close:hover { background: var(--bg-body); color: var(--text-primary); }

.modal-body { padding: 24px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-body);
    border-radius: 0 0 var(--radius) var(--radius);
}

.modal-desc {
    font-size: 0.9rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.field-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================================
   Alert success
   ============================================================ */
.alert-success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 0.88rem;
    margin-bottom: 16px;
}

/* ============================================================
   Password strength meter
   ============================================================ */
.pw-strength-wrapper {
    display: none;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}

.pw-strength-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.pw-strength-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.3s ease, background 0.3s ease;
}

.pw-strength-label {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    min-width: 60px;
}

/* ============================================================
   Change-password page layout
   ============================================================ */
.change-pw-card {
    max-width: 520px;
}

.change-pw-form {
    max-width: 440px;
}

/* ============================================================
   Avatar small
   ============================================================ */
.avatar-sm {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
}

/* ============================================================
   toggle password helper
   ============================================================ */

/* ============================================================
   AI OCR: Steps indicator
   ============================================================ */
.ocr-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 12px 0 4px;
    flex-wrap: nowrap;
}

.ocr-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition);
    min-width: 70px;
}

.ocr-step-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.ocr-step.active .ocr-step-icon {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
    animation: pulse-ring 1.2s ease infinite;
}

.ocr-step.active { color: var(--primary); }

.ocr-step.done .ocr-step-icon {
    background: var(--success);
    color: white;
}
.ocr-step.done { color: var(--success); }

.ocr-step-arrow {
    color: var(--border);
    font-size: 0.8rem;
    margin: 0 4px;
    padding-bottom: 18px;
    flex-shrink: 0;
}

@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0   rgba(59,130,246,0.4); }
    70%  { box-shadow: 0 0 0 8px rgba(59,130,246,0);   }
    100% { box-shadow: 0 0 0 0   rgba(59,130,246,0);   }
}

/* ============================================================
   AI OCR: no-key banner
   ============================================================ */
.ai-key-banner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ai-key-banner-icon {
    font-size: 1.8rem;
    color: #d97706;
    flex-shrink: 0;
    margin-top: 2px;
}

.ai-key-banner-body {
    flex: 1;
    min-width: 200px;
}

.ai-key-banner-title {
    font-weight: 700;
    color: #92400e;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.ai-key-banner-desc {
    font-size: 0.82rem;
    color: #78350f;
    line-height: 1.5;
}

.ai-key-banner-desc a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

/* ============================================================
   API Key Modal extras
   ============================================================ */
.api-key-info {
    background: var(--primary-light);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.api-key-info-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 0.87rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.api-key-info-row i { margin-top: 2px; flex-shrink: 0; }

.link-external {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}
.link-external:hover { text-decoration: underline; }

.api-key-current {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
    font-weight: 600;
    color: #15803d;
    margin-top: 10px;
}

/* API key set button style */
.btn-success-outline {
    color: var(--success) !important;
    border-color: var(--success) !important;
}
.btn-success-outline:hover { background: #f0fdf4 !important; }

/* ============================================================
   OCR error actions
   ============================================================ */
.ocr-error-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-left: auto;
}

