/* --- Resets & Base --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f7;
    min-height: 100vh;
    color: #1d1d1f;
    line-height: 1.5;
    margin: 0;
    padding: 0;
}

.container {
    width: 100%;
    max-width: 420px;
}

/* 認証コンテナ */
.auth-container {
    background: #ffffff;
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    margin: 40px auto;
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.auth-header h1 {
    color: #1d1d1f;
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.auth-header .subtitle {
    color: #86868b;
    font-size: 17px;
    font-weight: 400;
}

/* タブ */
.tabs {
    display: flex;
    margin-bottom: 32px;
    border-bottom: 1px solid #d2d2d7;
    gap: 0;
}

.tab-button {
    flex: 1;
    padding: 12px 0;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 17px;
    font-weight: 400;
    color: #86868b;
    position: relative;
    transition: color 0.2s ease;
    font-family: inherit;
}

.tab-button:hover {
    color: #1d1d1f;
}

.tab-button.active {
    color: #ff3b30;
    font-weight: 500;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: #ff3b30;
    border-radius: 2px 2px 0 0;
}

/* フォーム */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: #1d1d1f;
    font-size: 15px;
    letter-spacing: -0.2px;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
    padding: 14px 16px;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    font-size: 17px;
    font-family: inherit;
    background: #ffffff;
    color: #1d1d1f;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus {
    outline: none;
    border-color: #34c759;
    box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.1);
}

.form-group input::placeholder {
    color: #86868b;
}

.form-group small {
    color: #86868b;
    font-size: 13px;
    font-weight: 400;
    margin-top: 4px;
}

/* チェックボックス */
.checkbox-group {
    margin-top: -8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 15px;
    color: #1d1d1f;
    font-weight: 400;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #34c759;
    border-radius: 4px;
}

/* ボタン */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    letter-spacing: -0.2px;
    -webkit-appearance: none;
    appearance: none;
}

.btn-primary {
    background: #34c759;
    color: #ffffff;
    margin-top: 8px;
}

.btn-sm {
    margin-top: 8px;
}

.btn-primary:hover {
    background: #28a745;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(52, 199, 89, 0.2);
}

.btn-secondary {
    background: #f5f5f7;
    color: #1d1d1f;
    border: 1px solid #d2d2d7;
}

.btn-secondary:hover {
    background: #e8e8ed;
    border-color: #c7c7cc;
}

/* エラーメッセージ */
.error-message {
    background: #fff3f3;
    border: 1px solid #ff3b30;
    color: #d70015;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 15px;
    font-weight: 400;
}

/* ダッシュボード */
.dashboard {
    background: #ffffff;
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.3s ease-out;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid #d2d2d7;
}

.dashboard-header h1 {
    color: #1d1d1f;
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.user-info,
.token-info,
.firebase-status,
.system-selection {
    margin-bottom: 32px;
    padding: 24px;
    background: #f5f5f7;
    border-radius: 16px;
}

.user-info h2,
.token-info h3,
.firebase-status h3,
.system-selection h3 {
    margin-bottom: 16px;
    color: #1d1d1f;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.user-info p {
    margin-bottom: 12px;
    font-size: 15px;
    color: #1d1d1f;
}

.user-info p strong {
    color: #86868b;
    font-weight: 500;
    margin-right: 8px;
}

/* Token Display */
.token-display {
    word-break: break-all;
    background: #ffffff;
    padding: 16px;
    border-radius: 12px;
    font-size: 13px;
    border: 1px solid #d2d2d7;
}

.token-display strong {
    display: block;
    margin-bottom: 10px;
    color: #007aff;
    font-size: 14px;
    font-weight: 500;
}

.token-display code {
    background: #f5f5f7;
    padding: 8px 12px;
    border-radius: 8px;
    font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    color: #1d1d1f;
    display: block;
    line-height: 1.6;
}

/* Dashboard Specific Badge */
.firebase-status .status-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #d2d2d7;
}

.status-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #34c759;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.firebase-status .status-badge span:last-child {
    color: #1d1d1f;
    font-size: 15px;
    font-weight: 400;
}

/* System Cards (Dashboard) */
.system-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.system-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.system-card:hover {
    border-color: #007aff;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15);
    transform: translateY(-2px);
}

.system-card:active {
    transform: translateY(0);
}

.system-icon {
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f7;
    border-radius: 12px;
    flex-shrink: 0;
}

.system-content {
    flex: 1;
}

.system-content h4 {
    color: #1d1d1f;
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}

.system-content p {
    color: #86868b;
    font-size: 15px;
    font-weight: 400;
    margin: 0;
}

.system-arrow {
    color: #86868b;
    font-size: 20px;
    font-weight: 300;
    flex-shrink: 0;
}

.system-card:hover .system-arrow {
    color: #007aff;
    transform: translateX(4px);
    transition: all 0.2s ease;
}

/* ホームページ */
.home-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.home-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 40px;
    background: #ffffff;
    border-bottom: 1px solid #d2d2d7;
}

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

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

.logo-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #ff3b30;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    flex-shrink: 0;
}

.logo-text {
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
    letter-spacing: 0.5px;
}

.page-title {
    font-size: 28px;
    font-weight: 600;
    color: #1d1d1f;
    letter-spacing: -0.5px;
    margin: 0;
}

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

/* ヘッダー内「成約管理」リンク：縦位置を他要素と揃え、緑色 */
.header-contracts-link {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    margin: 0 !important;
    padding: 6px 12px;
    border: 1px solid #2e7d32;
    color: #2e7d32;
    background: transparent;
    border-radius: 6px;
    font-size: 14px;
    text-decoration: none;
    transition: color .15s, background-color .15s, border-color .15s;
}
.header-contracts-link:hover {
    color: #fff;
    background-color: #2e7d32;
    border-color: #2e7d32;
}

.user-email {
    font-size: 15px;
    color: #86868b;
    font-weight: 400;
}

.btn-login {
    padding: 10px 20px;
    background: #34c759;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-login:hover {
    background: #28a745;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
}

.btn-logout {
    padding: 10px 20px;
    background: #ff3b30;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-logout:hover {
    background: #d70015;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

.home-main {
    flex: 1;
    padding: 60px 40px;
    background: #f5f5f7;
    display: flex;
    justify-content: center;
    align-items: center;
}

.system-cards-container {
    display: flex;
    gap: 24px;
    max-width: 1200px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.home-system-card {
    background: #ffffff;
    border: 1px solid #d2d2d7;
    border-radius: 16px;
    padding: 40px;
    min-width: 300px;
    max-width: 400px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.home-system-card:active {
    transform: translateY(-2px);
}

/* --- Search Bar Styles --- */
.search-bar-container {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  padding: 0;           
  align-items: center;
  border-bottom: 1px solid #e5e5ea;
  height: 60px;         
}

.search-input, 
.search-select, 
.btn-search, 
.btn-secondary-small {
    height: 40px !important;  /* Force all elements to be exactly this height */
    box-sizing: border-box;
    font-size: 14px;
    border-radius: 8px;
    vertical-align: middle;
    margin: 0;                
}

/* Specific Widths/Flex */
.search-select {
    width: auto;
    max-width: 150px;
    padding: 0 30px 0 12px;
    border: 1px solid #d2d2d7;
    background-color: white;
    color: #1d1d1f;
    cursor: pointer;
}

.search-input {
    flex-grow: 1;
    padding: 0 15px;
    border: 1px solid #d2d2d7;
    max-width: 400px;
}

.search-input:focus, 
.search-select:focus {
    border-color: #0071e3;
    outline: none;
}

/* Buttons */
.btn-search {
    background-color: #1d1d1f;
    color: white;
    border: none;
    padding: 0 20px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary-small {
    background-color: #f5f5f7;
    color: #1d1d1f;
    border: 1px solid #d2d2d7;
    padding: 0 15px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-search:hover { background-color: #434345; }
.btn-secondary-small:hover { background-color: #e5e5ea; }

/* Home Card Themes (Red/Yellow/Green) */
#systemCardsContainer .home-system-card:first-child:hover {
    border-color: #2b7de9;
    box-shadow: 0 8px 24px rgba(43, 125, 233, 0.15);
    transform: translateY(-4px);
}
#systemCardsContainer .home-system-card:last-child:hover {
    border-color: #ffcc00;
    box-shadow: 0 8px 24px rgba(255, 204, 0, 0.15);
    transform: translateY(-4px);
}
#authCardsContainer .home-system-card:first-child:hover {
    border-color: #2b7de9;
    box-shadow: 0 8px 24px rgba(43, 125, 233, 0.15);
    transform: translateY(-4px);
}
#authCardsContainer .home-system-card:last-child:hover {
    border-color: #64a8e8;
    box-shadow: 0 8px 24px rgba(100, 168, 232, 0.15);
    transform: translateY(-4px);
}

/* Home Card Icons & Buttons */
.home-system-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
}
.home-system-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.3px;
}
.home-system-button {
    padding: 12px 32px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    width: 100%;
    color: #ffffff;
}
.home-system-button:hover {
    transform: translateY(-1px);
}

/* Specific Home Card Colors */
/* Login (Blue — ARISブランドカラー) */
#authCardsContainer .home-system-card:first-child .home-system-icon { background: #eff6ff; color: #2b7de9; }
#authCardsContainer .home-system-card:first-child .home-system-title { color: #2b7de9; }
#authCardsContainer .home-system-card:first-child .home-system-button { background: #2b7de9; }
#authCardsContainer .home-system-card:first-child .home-system-button:hover { background: #1a6dd4; box-shadow: 0 4px 12px rgba(43, 125, 233, 0.3); }

/* Signup (Light Blue) */
#authCardsContainer .home-system-card:last-child .home-system-icon { background: #f0f7ff; color: #64a8e8; }
#authCardsContainer .home-system-card:last-child .home-system-title { color: #64a8e8; }
#authCardsContainer .home-system-card:last-child .home-system-button { background: #64a8e8; color: #fff; }
#authCardsContainer .home-system-card:last-child .home-system-button:hover { background: #4a96d9; box-shadow: 0 4px 12px rgba(100, 168, 232, 0.3); }

/* aris (Blue — ロゴカラーに合わせる) */
#systemCardsContainer .home-system-card:first-child .home-system-icon { background: #eff6ff; color: #2b7de9; }
#systemCardsContainer .home-system-card:first-child .home-system-title { color: #2b7de9; }
#systemCardsContainer .home-system-card:first-child .home-system-button { background: #2b7de9; }
#systemCardsContainer .home-system-card:first-child .home-system-button:hover { background: #1a6dd4; box-shadow: 0 4px 12px rgba(43, 125, 233, 0.3); }

/* RA Dashboard (Blue) */
#raDashboardCard .home-system-icon { background: #eff6ff; color: #0d6efd; }
#raDashboardCard .home-system-title { color: #0d6efd; }
#raDashboardCard .home-system-button { background: #0d6efd; }
#raDashboardCard .home-system-button:hover { background: #0a58ca; box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3); }
#raDashboardCard:hover { border-color: #0d6efd; box-shadow: 0 8px 24px rgba(13, 110, 253, 0.15); transform: translateY(-4px); }

/* Salon Box (Yellow) */
#salonBoxCard .home-system-icon { background: #fffef0; color: #ffcc00; }
#salonBoxCard .home-system-title { color: #ffcc00; }
#salonBoxCard .home-system-button { background: #34c759; }
#salonBoxCard .home-system-button:hover { background: #28a745; box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3); }
#salonBoxCard:hover { border-color: #ffcc00; box-shadow: 0 8px 24px rgba(255, 204, 0, 0.15); transform: translateY(-4px); }


/* --- Admin / Table Styles (Merged) --- */
.main-content {
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

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

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

th, td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid #f5f5f7;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #86868b;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #fafafa;
}

/* Admin Table Status Badges */
.status-badge {
    font-size: 12px;
    font-weight: 600;
}

.status-new {
    background-color: #e3f2fd;
    color: #0d47a1;
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-block;
}

.status-deleted {
    background-color: #ffebee;
    color: #c62828;
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-block;
}

.status-default {
    background-color: #f5f5f5;
    color: #616161;
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-block;
}

/* Admin Action Buttons */
.action-btn {
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    font-size: 13px;
    font-weight: 500;
    margin-right: 8px;
    transition: all 0.2s;
}

.btn-edit {
    background: #fff3cd;
    color: #856404;
}

.btn-edit:hover {
    background: #ffe69c;
}

.btn-delete {
    background: #f8d7da;
    color: #721c24;
}

.btn-delete:hover {
    background: #f1b0b7;
}

.list-item-note {
    font-size: 13px;
    color: #666;
    background-color: #f0f0f5;
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 5px;
    font-style: italic;
}

/* --- Modals --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
}

.modal-content {
    position: relative;
    z-index: 1001;
    width: 100%;
    max-width: 480px;
    margin: 20px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

.modal-close {
    position: absolute;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    color: #1d1d1f;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1002;
}

.modal-close:hover {
    background: #ffffff;
    transform: scale(1.1);
}

.modal .auth-container {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    margin: 0;
    overflow-y: auto;
    padding: 32px 40px;
    border-radius: 20px;
    max-height: 100%;
}

/* --- Utilities & Animations --- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #0071e3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.hidden {
    display: none !important;
}

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

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.auth-container,
.dashboard {
    animation: fadeIn 0.3s ease-out;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .home-header {
        padding: 20px 24px;
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .page-title {
        font-size: 22px;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .home-main {
        padding: 40px 24px;
    }

    .system-cards-container {
        flex-direction: column;
        gap: 20px;
    }

    .home-system-card {
        min-width: 100%;
        max-width: 100%;
    }
}


/* 進捗管理ページ */
.progress-main {
    min-height: calc(100vh - 80px);
    padding: 40px;
    background: #f5f5f7;
}

.progress-container {
    max-width: 1200px;
    margin: 0 auto;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #d2d2d7;
}

.progress-header h1 {
    font-size: 32px;
    font-weight: 600;
    color: #1d1d1f;
    letter-spacing: -0.5px;
    margin: 0;
}

.progress-header .btn {
    display: flex;
    align-items: center;
    margin: 0;
}

.progress-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.progress-card {
    background: #ffffff;
    border: 1px solid #d2d2d7;
    border-radius: 16px;
    padding: 24px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.progress-card:hover {
    border-color: #007aff;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.15);
    transform: translateY(-2px);
}

.progress-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.progress-card-title-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-card-title {
    font-size: 20px;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0;
    letter-spacing: -0.3px;
    line-height: 1.3;
}

.progress-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    width: fit-content;
}

.status-todo {
    background: #f5f5f7;
    color: #86868b;
}

.status-in-progress {
    background: #fff5f5;
    color: #ff3b30;
}

.status-completed {
    background: #f0fdf4;
    color: #34c759;
}

.status-on-hold {
    background: #fffef0;
    color: #ffcc00;
}

.progress-card-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f7;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1d1d1f;
    padding: 0;
}

.btn-icon:hover {
    background: #e8e8ed;
    transform: scale(1.05);
}

.btn-icon-danger {
    color: #ff3b30;
}

.btn-icon-danger:hover {
    background: #fff5f5;
}

.progress-card-body {
    flex: 1;
}

.progress-card-description {
    color: #86868b;
    font-size: 15px;
    line-height: 1.5;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* --- Embedded Mode (Iframe) --- */
body.is-embedded #sidebar,
body.is-embedded .header {
    display: none !important;
}

body.is-embedded .content-wrapper {
    margin-left: 0 !important;
    padding: 15px !important;
    margin-top: 0 !important;
    width: 100% !important;
}

#sidePanel {
    width: 80% !important;
}

body.is-embedded .mb-3 a { 
    display: none !important;
}

body.is-embedded .card-body {
    padding: 1rem;
}

body.is-embedded .profile-header-card {
    padding: 15px;
    margin-bottom: 15px;
}
.progress-card-footer {
    padding-top: 12px;
    border-top: 1px solid #f5f5f7;
}

.progress-card-date {
    color: #86868b;
    font-size: 13px;
    font-weight: 400;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    gap: 16px;
}

.empty-state svg {
    margin-bottom: 8px;
}

.empty-state h3 {
    font-size: 22px;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0;
    letter-spacing: -0.3px;
}

.empty-state p {
    font-size: 15px;
    color: #86868b;
    margin: 0 0 24px 0;
}

.empty-state .btn {
    margin: 0;
}

/* フォーム内のtextareaとselect */
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #34c759;
    box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.1);
}

.form-group textarea::placeholder {
    color: #86868b;
}

/* 進捗ページ内フラットテーブル（monday-table）の列幅：10列 */
/* 旧UIの nth-child 列幅指定は削除済み。列幅は progress-style.css でクラスベースで管理 */

/* 読み（RAヨミ・CAヨミ）ランクの色分け：Aから順に目立つ色（テーブル内の継承色を上書き） */
.progress-yomi-rank { font-weight: bold; }
.progress-yomi-rank-s,
#progressSalonContainer .progress-yomi-rank-s,
.monday-table .progress-yomi-rank-s { color: #c9a227 !important; }   /* S: 金（最上位） */
.progress-yomi-rank-a,
#progressSalonContainer .progress-yomi-rank-a,
.monday-table .progress-yomi-rank-a { color: #c62828 !important; }   /* A: 赤（最も目立つ） */
.progress-yomi-rank-b,
#progressSalonContainer .progress-yomi-rank-b,
.monday-table .progress-yomi-rank-b { color: #2e7d32 !important; }  /* B: 緑 */
.progress-yomi-rank-c,
#progressSalonContainer .progress-yomi-rank-c,
.monday-table .progress-yomi-rank-c { color: #ef6c00 !important; }  /* C: オレンジ */
.progress-yomi-rank-d,
#progressSalonContainer .progress-yomi-rank-d,
.monday-table .progress-yomi-rank-d { color: #1565c0 !important; }  /* D: 青 */
.progress-yomi-rank-e,
#progressSalonContainer .progress-yomi-rank-e,
.monday-table .progress-yomi-rank-e { color: #6a1b9a !important; }  /* E: 紫 */
.progress-yomi-rank-other,
#progressSalonContainer .progress-yomi-rank-other,
.monday-table .progress-yomi-rank-other { color: #616161 !important; } /* 数字など: グレー */

/* サロンコードリンク（求職者名と同じホバー色） */
.progress-salon-link { cursor: pointer; color: #0d6efd; text-decoration: none; border-bottom: 1px solid transparent; transition: color .15s, border-color .15s; }
.progress-salon-link:hover { text-decoration: underline; border-bottom-color: #0d6efd; color: #0a58ca; }

/* 進捗管理テーブル */
.progress-table-wrapper {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #d2d2d7;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.progress-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.progress-table thead {
    background: #f5f5f7;
    border-bottom: 2px solid #d2d2d7;
}

.progress-table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: #1d1d1f;
    font-size: 14px;
    letter-spacing: -0.2px;
    white-space: nowrap;
}

.progress-table th:first-child {
    padding-left: 24px;
}

.progress-table th:last-child {
    padding-right: 24px;
    text-align: center;
    min-width: 120px;
    width: auto;
}

.progress-table tbody tr {
    border-bottom: 1px solid #f5f5f7;
    transition: background-color 0.2s ease;
}

.progress-table tbody tr:hover {
    background-color: #fafafa;
}

.progress-table tbody tr:last-child {
    border-bottom: none;
}

.progress-table td {
    padding: 16px;
    color: #1d1d1f;
    vertical-align: middle;
}

.progress-table td:first-child {
    padding-left: 24px;
}

/* グループ化された行では、求職者名セル以外の最初の子要素には24pxを適用しない */
.progress-table-row-grouped td:first-child:not(.job-seeker-name-cell) {
    padding-left: 16px !important;
}

.progress-table td:last-child {
    padding-right: 24px;
    text-align: center;
    white-space: nowrap;
}

/* サロンコード列の配置を統一（rowspan使用時も列位置を揃える） */
/* rowspanを使用している場合、すべての行でサロンコードは2番目の子要素 */
.progress-table-row-grouped td:nth-child(2) {
    padding-left: 16px !important;
    padding-right: 16px;
    text-align: left;
    box-sizing: border-box;
}

/* 求職者名セルの直後のサロンコード列に確実にパディングを適用 */
.job-seeker-name-cell + td {
    padding-left: 16px !important;
}

/* 2行目以降で求職者名セルがない場合、サロンコード列が1番目の子要素になるため、確実に16pxを適用 */
/* より確実な方法：グループ化された行の最初の子要素で、求職者名セルでない場合は16px */
.progress-table-row-grouped td:first-child:not(.job-seeker-name-cell) {
    padding-left: 16px !important;
}

.progress-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

/* ステータスバッジ */
.status-meeting {
    background: #fff5f5;
    color: #ff3b30;
}

.status-standby {
    background: #fffef0;
    color: #ffcc00;
}

.status-active {
    background: #f0f9ff;
    color: #007aff;
}

.status-decided {
    background: #f0fdf4;
    color: #34c759;
}

.status-archived {
    background: #f5f5f7;
    color: #86868b;
}

/* 進捗バッジ */
.progress-meeting {
    background: #fef3c7;
    color: #92400e;
}

.progress-visit {
    background: #f0f9ff;
    color: #007aff;
}

.progress-interview {
    background: #ede9fe;
    color: #6b21a8;
}

.progress-offer {
    background: #dcfce7;
    color: #166534;
}

.progress-accepted {
    background: linear-gradient(135deg, #fef9c3 0%, #fde68a 100%);
    color: #854d0e;
    font-weight: 600;
    border: 2px solid #f59e0b;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.table-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.progress-table-row {
    cursor: default;
}

.progress-table-row-empty {
    opacity: 0.7;
}

.progress-table-row-empty td {
    color: #86868b;
}

/* グループ化された進捗行 */
.progress-table-row-grouped {
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

.progress-table-row-grouped:hover {
    background-color: #fafafa;
    border-left-color: #007aff;
}

.job-seeker-name-cell {
    background: #f8f9fa;
    vertical-align: top;
    padding: 16px !important;
    padding-right: 16px !important;
    font-weight: 600;
    width: auto;
    min-width: 150px;
    box-sizing: border-box;
    position: relative;
}

/* 求職者名セルの右側に視覚的な区切りを追加（borderではなく疑似要素を使用） */
.job-seeker-name-cell::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}

.job-seeker-name-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.job-seeker-name-wrapper strong {
    font-size: 15px;
    color: #1d1d1f;
    font-weight: 600;
}

.job-seeker-status-wrapper {
    margin-top: 8px;
}

.progress-count-badge {
    display: inline-block;
    background: #e9ecef;
    color: #495057;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    margin-top: 8px;
}

.btn-create-progress {
    padding: 8px 16px;
    font-size: 14px;
    white-space: nowrap;
    min-width: 100px;
    width: auto;
}

/* CAセクション */
.ca-progress-section {
    margin-bottom: 32px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #d2d2d7;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ca-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: #f5f5f7;
    border-bottom: 2px solid #d2d2d7;
}

.ca-section-title {
    font-size: 20px;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0;
    letter-spacing: -0.3px;
}

.ca-section-count {
    font-size: 14px;
    color: #86868b;
    font-weight: 400;
}

.ca-progress-table-wrapper {
    overflow-x: auto;
}

/* レスポンシブ - 進捗管理ページ */
@media (max-width: 768px) {
    .progress-main {
        padding: 24px 16px;
    }

    .progress-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .progress-header h1 {
        font-size: 24px;
    }

    .progress-header .btn {
        width: 100%;
        justify-content: center;
    }

    .progress-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .progress-table {
        min-width: 800px;
    }

    .progress-table th,
    .progress-table td {
        padding: 12px 8px;
        font-size: 14px;
    }

    .progress-table th:first-child,
    .progress-table td:first-child {
        padding-left: 16px;
    }

    .progress-table th:last-child,
    .progress-table td:last-child {
        padding-right: 16px;
    }

    .progress-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .progress-card {
        padding: 20px;
    }

    .empty-state {
        padding: 60px 20px;
    }
}

@media (max-width: 600px) {
    body {
        padding: 16px;
    }

    .auth-container,
    .dashboard {
        padding: 32px 24px;
        border-radius: 16px;
    }

    .auth-header h1 {
        font-size: 28px;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }

    .user-info,
    .token-info,
    .firebase-status,
    .system-selection {
        padding: 20px;
    }
}

/* --- Advanced Pagination Styles --- */
.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px; /* Slightly wider gap */
  margin-top: 30px;
  padding: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.page-btn {
  min-width: 36px; /* Slightly larger */
  height: 36px;
  padding: 0 10px;
  border: 1px solid #d2d2d7;
  background-color: #ffffff;
  color: #1d1d1f;
  border-radius: 8px; /* Softer corners */
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  outline: none;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05); /* Subtle shadow */
}

.page-btn:hover:not(:disabled) {
  background-color: #f5f5f7;
  border-color: #86868b;
  transform: translateY(-1px); /* Micro-interaction */
}

.page-btn:active:not(:disabled) {
  transform: translateY(0);
  background-color: #e5e5ea;
}

.page-btn.active {
  background-color: #0071e3 !important; /* Force Blue */
  color: #ffffff !important;
  border-color: #0071e3 !important;
  pointer-events: none;
  box-shadow: 0 2px 4px rgba(0, 113, 227, 0.3);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background-color: #f5f5f7;
  border-color: #e5e5ea;
  box-shadow: none;
}

.page-dots {
  color: #86868b;
  font-weight: bold;
  padding: 0 4px;
  user-select: none;
  letter-spacing: 2px;
}

/* Total Count Styling */
.pagination-info {
  margin-left: 15px;
  font-size: 13px;
  color: #6e6e73;
  font-weight: 500;
}

/* --- Toast Notifications --- */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}
.toast-message {
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    margin-top: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    font-size: 14px;
    animation: slideIn 0.3s ease-out;
}
.toast-success { background: #34c759; }
.toast-error { background: #ff3b30; }
.toast-info { background: #007aff; }

@keyframes slideIn {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes slideOut {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(100%); opacity: 0; }
}

/* --- Monday.com Style Layout --- */

/* Group Headers */
.group-header-row td {
    background-color: #fff !important;
    padding: 0 !important;
    border: none !important;
}

.group-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 16px;
    color: #1d1d1f;
    cursor: pointer;
    transition: background-color 0.2s;
    user-select: none;
    margin-top: 40px; /* Spacing between tables */
    border-radius: 8px 8px 0 0;
    background: white;
    border: 1px solid #e1e3e7;
    border-bottom: none;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.02);
}

.group-header:first-child {
    margin-top: 0;
}

/* Row Styling */
.user-row td {
    background: white;
}

.user-row.last-in-group td {
    border-bottom: 1px solid #e1e3e7;
}

/* Table Layout */
.monday-table {
    table-layout: fixed;
    width: 100%;
}

.monday-table th {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Column widths are set inline in JS (job-seekers.js) */

/* Group Table Wrapper */
.group-table-wrapper {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

/* Group Header Bar (clickable) */
.group-header-bar {
    cursor: pointer;
    padding: 12px 16px;
    background-color: #fafafa;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.group-header-bar:hover {
    background-color: #f0f0f0;
}

.group-label {
    font-size: 14px;
    font-weight: 600;
}

.group-count {
    font-size: 12px;
    font-weight: 500;
}

.group-chevron {
    transition: transform 0.2s ease;
    font-size: 12px;
    color: #666;
}

/* Group Colors - Left Border on Wrapper */
.group-table-wrapper.group-meeting { border-left: 6px solid #ff6b6b; }
.group-table-wrapper.group-standby { border-left: 6px solid #ffcb00; }
.group-table-wrapper.group-activity { border-left: 6px solid #0073ea; }
.group-table-wrapper.group-decision { border-left: 6px solid #00c875; }
.group-table-wrapper.group-archive { border-left: 6px solid #a2a2a2; }
.group-table-wrapper.group-other { border-left: 6px solid #999; }


/* Subitems Layout */
.col-toggle {
    cursor: pointer;
    text-align: center;
    vertical-align: middle;
}

.col-toggle i {
    transition: transform 0.2s ease;
    color: #c4c4c4;
}

.user-row.expanded .col-toggle i {
    transform: rotate(90deg);
    color: #0073ea;
}

.subitem-count {
    display: inline-block;
    font-size: 0.65rem;
    background: #e9ecef;
    color: #495057;
    border-radius: 10px;
    padding: 1px 5px;
    margin-left: 2px;
    font-weight: 600;
    vertical-align: middle;
    line-height: 1.4;
}

/* CAメモ truncation with tooltip */
.yomi-memo-text {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
    cursor: default;
}

/* Name column: left-align for readability */
.monday-table td.col-name {
    text-align: left;
}

/* Subitem table: truncate long text cells with tooltip support */
.subitem-table td.salon-name-cell {
    max-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Name link (same style as progress page progress-name-link) */
.js-name-link {
    cursor: pointer;
    color: #0d6efd;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color .15s, border-color .15s;
}
.js-name-link:hover {
    text-decoration: underline;
    border-bottom-color: #0d6efd;
    color: #0a58ca;
}

/* Toggle + 削除 columns: no ellipsis clipping, compact padding */
.monday-table .col-toggle {
    overflow: visible;
    text-overflow: clip;
    padding: 2px 6px !important;
    white-space: nowrap;
    cursor: pointer;
}

.monday-table .col-action {
    overflow: visible;
    text-overflow: clip;
    padding: 2px 4px !important;
}
.monday-table .col-action .btn-sm {
    padding: 2px 6px;
    font-size: 11px;
    line-height: 1.2;
}

/* Active軸 column: full-cell colored (Monday.com-style) */
.monday-table .col-axis {
    padding: 0 !important;
    height: 1px;
}
.monday-table .col-axis .status-cell {
    height: 100%;
    width: 100%;
    min-height: 32px;
    font-size: 12px;
}

/* ステータス column: full-cell colored */
.monday-table .col-status {
    padding: 0 !important;
    height: 1px;
}
.monday-table .col-status .status-cell {
    height: 100%;
    width: 100%;
    min-height: 32px;
    font-size: 12px;
}

.subitem-row > td {
    padding: 0 !important;
    border-bottom: none !important;
    background-color: #f5f5f7;
    /* Ensure colspan cell doesn't affect main table grid */
    width: 100%; 
    box-sizing: border-box;
    display: table-cell; 
}

.subitem-container {
    padding: 10px 10px 10px 60px; /* Indent */
    background-color: #f5f5f7;
    box-shadow: inset 0 4px 6px -4px rgba(0,0,0,0.1);
    border-left: 4px solid #e6e9ef;
    margin-left: 20px;
    /* Ensure container flows naturally */
    display: block;
    width: auto;
}

.subitem-content {
    overflow-x: auto;
}

.subitem-table {
    /* Isolate Inner Grid */
    table-layout: fixed;
    width: 100%;
    min-width: 1470px;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 0;
    border-collapse: collapse;
    border: 1px solid #b0b0b0;
}

.subitem-table th {
    background: #f0f0f0;
    font-size: 11px;
    padding: 6px 8px;
    border: 1px solid #c0c0c0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    vertical-align: middle;
}

.subitem-table td {
    font-size: 12px;
    padding: 6px 8px;
    border: 1px solid #c0c0c0 !important;
    border-top: 1px solid #c0c0c0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    vertical-align: middle;
}

/* Nested table: only hovered row highlights, override parent monday-table hover */
.subitem-table tbody tr:hover td {
    background-color: #f0f4ff !important;
}
.subitem-row:hover > td {
    background-color: #f5f5f7 !important;
}

/* Active軸 + Slack/Contract: full-cell colored style */
.subitem-table .subitem-active-axis {
    padding: 0 !important;
    height: 1px;
}

.subitem-table .subitem-active-axis .status-cell {
    height: 100%;
    width: 100%;
    min-height: 32px;
    font-size: 11px;
}

/* Full-cell color classes for Slack CH, Slackスレ, 成約詳細 */
.subitem-slack-ch  { background-color: #ffcb00; color: #333; }
.subitem-slack-th  { background-color: #579bfc; color: #fff; }
.subitem-contract  { background-color: #00c875; color: #fff; }
