/* QMS Admin 管理画面スタイル */

:root {
    --admin-primary: #2563eb;
    --admin-primary-dark: #1d4ed8;
    --admin-bg: #f1f5f9;
    --admin-card-bg: #ffffff;
    --admin-header-bg: #1e293b;
    --admin-text: #334155;
    --admin-text-light: #64748b;
    --admin-border: #e2e8f0;
    --admin-success: #16a34a;
    --admin-warning: #d97706;
    --admin-danger: #dc2626;
    --admin-info: #0284c7;
}

.admin-body {
    background: var(--admin-bg);
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--admin-text);
    min-height: 100vh;
}

/* ヘッダー */
.admin-header {
    background: var(--admin-header-bg);
    color: #fff;
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header h1 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
}

.admin-header-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}

.admin-header-nav a {
    color: #94a3b8;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.admin-header-nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.admin-header-nav a.active {
    color: #fff;
    background: var(--admin-primary);
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #94a3b8;
}

/* メインコンテンツ */
.admin-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* カード */
.admin-card {
    background: var(--admin-card-bg);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.admin-card h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: var(--admin-text);
}

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

.card-header h2 {
    margin-bottom: 0;
}

/* 概況カード */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.summary-card {
    background: var(--admin-card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.summary-label {
    font-size: 13px;
    color: var(--admin-text-light);
    margin-bottom: 8px;
}

.summary-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--admin-primary);
}

/* テーブル */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th {
    background: #f8fafc;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--admin-text-light);
    border-bottom: 2px solid var(--admin-border);
    white-space: nowrap;
}

.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--admin-border);
}

.admin-table tr:hover {
    background: #f8fafc;
}

/* ステータスバッジ */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.trial {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-badge.active {
    background: #dcfce7;
    color: #15803d;
}

.status-badge.suspended {
    background: #fee2e2;
    color: #b91c1c;
}

.status-badge.pending {
    background: #f3f4f6;
    color: #4b5563;
}

.status-badge.invoiced {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-badge.paid {
    background: #dcfce7;
    color: #15803d;
}

.status-badge.overdue {
    background: #fee2e2;
    color: #b91c1c;
}

/* フォーム */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--admin-text);
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-control-sm {
    padding: 6px 10px;
    font-size: 13px;
    width: auto;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--admin-text-light);
    margin-top: 4px;
}

.required {
    color: var(--admin-danger);
}

textarea.form-control {
    resize: vertical;
}

/* フィルター */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

/* ボタン */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-primary {
    background: var(--admin-primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--admin-primary-dark);
}

.btn-outline {
    background: transparent;
    color: var(--admin-text);
    border: 1px solid var(--admin-border);
}

.btn-outline:hover:not(:disabled) {
    background: #f8fafc;
}

.btn-danger {
    background: var(--admin-danger);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
}

.btn-success {
    background: var(--admin-success);
    color: #fff;
}

.btn-warning {
    background: var(--admin-warning);
    color: #fff;
}

.btn-lg {
    padding: 10px 24px;
    font-size: 15px;
}

/* モーダル */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-lg {
    max-width: 640px;
}

.modal h2 {
    font-size: 18px;
    margin: 0 0 20px 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--admin-border);
}

/* ログイン */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: var(--admin-card-bg);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.login-card h1 {
    font-size: 24px;
    margin: 0 0 8px 0;
    color: var(--admin-primary);
}

.login-subtitle {
    color: var(--admin-text-light);
    margin-bottom: 28px;
}

.login-error {
    color: var(--admin-danger);
    font-size: 14px;
    margin-bottom: 12px;
    padding: 8px;
    background: #fef2f2;
    border-radius: 6px;
}

.login-btn {
    width: 100%;
    margin-top: 8px;
}

/* 詳細グリッド */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.detail-item {
    padding: 8px 0;
}

.detail-item label {
    display: block;
    font-size: 12px;
    color: var(--admin-text-light);
    margin-bottom: 4px;
}

.detail-item span,
.detail-item a {
    font-size: 15px;
    font-weight: 500;
}

.detail-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* パンくずリスト */
.breadcrumb {
    font-size: 14px;
    color: var(--admin-text-light);
    margin-bottom: 16px;
}

.breadcrumb a {
    color: var(--admin-primary);
    text-decoration: none;
}

/* ユーティリティ */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }

/* トースト */
.toast-container {
    position: fixed;
    top: 72px;
    right: 20px;
    z-index: 300;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: slideIn 0.3s ease;
}

.toast.success { background: var(--admin-success); color: #fff; }
.toast.error { background: var(--admin-danger); color: #fff; }
.toast.info { background: var(--admin-info); color: #fff; }

@keyframes slideIn {
    from { transform: translateX(50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* レスポンシブ */
@media (max-width: 768px) {
    .admin-header {
        flex-wrap: wrap;
        height: auto;
        padding: 12px;
    }
    .admin-header-nav {
        order: 3;
        flex-basis: 100%;
        overflow-x: auto;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .detail-row {
        grid-template-columns: 1fr;
    }
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}
