/**
 * 売上管理システム v2.0 - ダーク＆プレミアムテーマ
 * I'm Kitchen - adm.im-kitchen.jp
 */

/* ===== 変数 ===== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: rgba(99,102,241,0.12);
    --primary-glow: rgba(99,102,241,0.25);
    --success: #22c55e;
    --success-light: rgba(34,197,94,0.12);
    --warning: #eab308;
    --warning-light: rgba(234,179,8,0.12);
    --danger: #ef4444;
    --danger-light: rgba(239,68,68,0.12);

    --bg: #0f1117;
    --bg-secondary: #13151d;
    --surface: #1a1d27;
    --surface-2: #222633;
    --surface-3: #2a2e3d;
    --border: rgba(255,255,255,0.06);
    --border-hover: rgba(255,255,255,0.12);

    --text: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-dim: #64748b;
    --text-white: #ffffff;

    --sidebar-width: 240px;
    --sidebar-collapsed: 64px;
    --topbar-height: 56px;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
    --transition: all 0.25s ease;
}

/* ===== リセット ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
}

/* ===== スクロールバー ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ===== トップナビバー ===== */
.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    backdrop-filter: blur(12px);
}

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

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-dim);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--surface-2);
    color: var(--primary);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-white);
}

.navbar-brand i {
    font-size: 20px;
    color: var(--primary);
}

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

.navbar-date {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dim);
    font-size: 13px;
}

.navbar-user .dropdown-toggle {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-xs);
    transition: var(--transition);
}

.navbar-user .dropdown-toggle:hover {
    background: var(--surface-2);
    color: var(--text-white);
}

.navbar-user .dropdown-toggle::after {
    display: none;
}

/* Bootstrap dropdown override for dark */
.dropdown-menu {
    background: var(--surface-2);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}
.dropdown-item {
    color: var(--text-secondary);
}
.dropdown-item:hover {
    background: var(--surface-3);
    color: var(--text-white);
}

/* ===== サイドバー ===== */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 900;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-link span,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .sidebar-group-header span,
.sidebar.collapsed .sidebar-group-arrow {
    display: none;
}

.sidebar.collapsed .sidebar-group-header {
    justify-content: center;
    padding: 10px 12px;
    margin: 2px 4px;
}

.sidebar.collapsed .sidebar-group-label {
    justify-content: center;
}

.sidebar.collapsed .sidebar-group-items {
    max-height: 0 !important;
}

.sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .sidebar-link i {
    margin: 0;
    font-size: 18px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-item {
    margin: 2px 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 13px;
    font-weight: 500;
}

.sidebar-link:hover {
    background: var(--surface-2);
    color: var(--text);
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 15px;
}

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

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    text-align: center;
    font-size: 11px;
}

/* ===== メインコンテンツ ===== */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
    transition: var(--transition);
}

.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed);
}

.content-wrapper {
    padding: 28px;
    max-width: 1440px;
}

/* ===== ページヘッダー ===== */
.page-header {
    margin-bottom: 28px;
}

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-white);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h1 i {
    color: var(--primary);
    font-size: 22px;
}

.page-header p {
    color: var(--text-secondary);
    margin: 6px 0 0;
    font-size: 13px;
}

.business-hours-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    margin-left: 8px;
    font-weight: 500;
}

/* ===== LIVEバッジ ===== */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    margin-left: 12px;
    vertical-align: middle;
    letter-spacing: 0.5px;
    transition: opacity 0.3s;
}

.live-badge.paused {
    opacity: 0.4;
}

.live-badge.syncing {
    animation: livePulse 0.6s ease-in-out;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: liveBlink 2s ease-in-out infinite;
}

@keyframes liveBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes livePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* ===== 日付ナビゲーション ===== */
.date-navigator {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 5px;
}

.date-nav-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    transition: var(--transition);
}

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

.date-nav-input {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    font-size: 15px;
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 600;
    color: var(--text-white);
    background: var(--surface-2);
    cursor: pointer;
    outline: none;
    min-width: 155px;
    text-align: center;
    color-scheme: dark;
}

.date-nav-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.date-nav-today {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    border: none;
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.3px;
}

.date-nav-today:hover:not(:disabled) {
    box-shadow: 0 0 20px rgba(239,68,68,0.3);
    transform: translateY(-1px);
}

.date-nav-today:disabled,
.date-nav-today.active {
    opacity: 0.5;
    cursor: default;
}

/* ===== カード ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
}

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

.card-header h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i {
    color: var(--text-dim);
    font-size: 14px;
}

.card-body {
    padding: 22px;
}

/* ===== 統計カード（ダッシュボード） ===== */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.stat-top h4 {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.stat-icon-glow {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.stat-icon-glow.blue {
    background: rgba(99,102,241,0.15);
    color: #818cf8;
    box-shadow: 0 0 20px rgba(99,102,241,0.08);
}
.stat-icon-glow.green {
    background: rgba(34,197,94,0.15);
    color: #4ade80;
    box-shadow: 0 0 20px rgba(34,197,94,0.08);
}
.stat-icon-glow.orange {
    background: rgba(234,179,8,0.15);
    color: #facc15;
    box-shadow: 0 0 20px rgba(234,179,8,0.08);
}
.stat-icon-glow.red {
    background: rgba(239,68,68,0.15);
    color: #f87171;
    box-shadow: 0 0 20px rgba(239,68,68,0.08);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-white);
    line-height: 1.2;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 6px;
}

/* ===== テーブル（エクセル風） ===== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 10px 14px;
    border: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
    color: var(--text);
}

.data-table th {
    background: var(--surface-2);
    font-weight: 600;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
    font-size: 12px;
    letter-spacing: 0.3px;
}

.data-table td:first-child,
.data-table th:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--surface);
    z-index: 5;
    font-weight: 500;
}

.data-table th:first-child {
    background: var(--surface-2);
    z-index: 15;
}

.data-table tbody tr:hover {
    background: var(--surface-2);
}

.data-table .total-row {
    background: var(--primary-light) !important;
    font-weight: 700;
    color: var(--text-white);
}

.data-table .total-row td:first-child {
    background: var(--primary-light);
}

/* ===== ボタン ===== */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 0 20px var(--primary-glow);
}

.btn-refresh {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-refresh.header-refresh {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius);
    margin-right: 4px;
}

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

.btn-refresh.btn-airregi-sync {
    background: rgba(34,197,94,0.08);
    border-color: rgba(34,197,94,0.25);
    color: #4ade80;
    font-size: 12px;
    padding: 5px 12px;
}
.btn-refresh.btn-airregi-sync:hover {
    background: rgba(34,197,94,0.18);
    border-color: #4ade80;
    color: #4ade80;
}

.btn-refresh.loading i {
    animation: spin 1s linear infinite;
}

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

/* ===== ログイン画面 ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(99,102,241,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(139,92,246,0.08) 0%, transparent 50%);
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    font-size: 20px;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text-white);
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
    margin-bottom: 28px;
}

.login-card .form-label {
    color: var(--text-secondary);
}

.login-card .form-control {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-white);
    font-size: 14px;
}

.login-card .form-control::placeholder {
    color: var(--text-dim);
}

.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--surface-2);
    color: var(--text-white);
}

.login-card .btn-login {
    width: 100%;
    padding: 10px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.login-card .btn-login:hover {
    background: var(--primary-dark);
    box-shadow: 0 0 24px var(--primary-glow);
}

.login-error {
    background: var(--danger-light);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    text-align: center;
    border: 1px solid rgba(239,68,68,0.2);
}

/* ===== アラート ===== */
.alert {
    border-radius: var(--radius-sm);
    font-size: 13px;
    border: none;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid rgba(34,197,94,0.2);
}

.alert-danger {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(239,68,68,0.2);
}

.alert-info {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(99,102,241,0.2);
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid rgba(234,179,8,0.2);
}

/* ===== レスポンシブ ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .content-wrapper {
        padding: 16px;
    }

    .navbar-date {
        display: none;
    }

    .page-header-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .date-navigator {
        width: 100%;
        justify-content: center;
    }
}

/* ===== ローディング ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15,17,23,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--surface-3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===== グリッドユーティリティ ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* 3カラムレイアウト（店頭詳細 | ランキング | 月間+構成比） */
.row-3col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* 右カラムの縦積み */
.col-right-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .row-3col { grid-template-columns: 1fr 1fr; }
    .row-3col > .col-right-stack { grid-column: 1 / -1; flex-direction: row; }
}

@media (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .row-3col { grid-template-columns: 1fr; }
    .row-3col > .col-right-stack { flex-direction: column; }
}

/* ===== テキストユーティリティ ===== */
.text-muted { color: var(--text-dim) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }

/* ===== 店頭売上詳細カード ===== */
.store-detail-card {
    border-left: 3px solid var(--warning);
}

.store-detail-card .card-header h3 {
    font-size: 13px;
}

.badge-store {
    display: inline-flex;
    align-items: center;
    background: var(--warning-light);
    color: var(--warning);
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

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

.store-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.store-detail-row:last-child {
    border-bottom: none;
}

.store-detail-row:hover {
    background: var(--surface-2);
    border-radius: var(--radius-xs);
}

.store-detail-row.highlight {
    background: var(--surface-2);
    border-radius: var(--radius-xs);
    padding: 12px 10px;
    margin-bottom: 4px;
    border-bottom: none;
}

.store-detail-label {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.store-detail-label i {
    width: 16px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
}

.store-detail-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.store-detail-value.accent {
    font-size: 20px;
    font-weight: 700;
    color: var(--warning);
}

.store-detail-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-hover), transparent);
    margin: 8px 0;
}

/* ===== 月間合計カード ===== */
.monthly-summary-card {
    border-left: 3px solid var(--primary);
    display: flex;
    flex-direction: column;
}

.monthly-summary-card .card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
}

.monthly-total-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-white);
    line-height: 1.2;
    margin-bottom: 12px;
    font-variant-numeric: tabular-nums;
}

.monthly-breakdown {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.monthly-sep {
    color: var(--text-dim);
}

/* ===== グリッド高さ揃え ===== */
.grid-2-stretch {
    align-items: stretch;
}

.grid-2-match {
    align-items: stretch;
}

.grid-2-match > .card {
    display: flex;
    flex-direction: column;
}

.grid-2-match > .card > .card-body {
    flex: 1;
}

.card-flex-fill {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-body-scroll {
    flex: 1;
    overflow: auto;
    max-height: 300px;
}

/* ダッシュボード用コンパクトテーブル */
.compact-table {
    width: 100%;
    table-layout: auto;
}

.compact-table th,
.compact-table td {
    padding: 8px 10px;
    font-size: 12px;
    white-space: normal;
    word-break: break-word;
}

.compact-table td:first-child,
.compact-table th:first-child {
    position: static;
    background: inherit;
}

.compact-table th:first-child {
    position: static;
    background: var(--surface-2);
}

/* ===== ブランドランキングカード ===== */
.ranking-card {
    border-left: 3px solid var(--primary);
    overflow: hidden;
}

.ranking-card .card-body {
    overflow-y: auto;
}

.ranking-card .data-table {
    table-layout: fixed;
    width: 100%;
}

.ranking-card .data-table th:first-child,
.ranking-card .data-table td:first-child {
    width: auto;
    word-break: break-all;
    overflow-wrap: break-word;
    white-space: normal;
}

.ranking-card .data-table th:nth-child(2),
.ranking-card .data-table td:nth-child(2) {
    width: 60px;
    text-align: center;
    white-space: nowrap;
}

.ranking-card .data-table th:nth-child(3),
.ranking-card .data-table td:nth-child(3) {
    width: 80px;
    text-align: right;
    white-space: nowrap;
}

/* ===== 時間帯別サマリー ===== */
.period-summary {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.period-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 11px;
    line-height: 1.3;
    min-width: 110px;
}

.period-label {
    color: var(--text-dim);
    font-size: 10px;
    margin-bottom: 2px;
}

.period-value {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.3px;
}

.period-orders {
    color: var(--text-secondary);
    font-size: 11px;
}

/* ===== サービス構成比カード ===== */
.service-pie-card {
    border-left: 3px solid #a78bfa;
}

/* ===== 売上管理ページ（エクセル風テーブル） ===== */
.month-navigator {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sales-table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 220px);
    -webkit-overflow-scrolling: touch;
}

.sales-grid {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.sales-grid th,
.sales-grid td {
    padding: 6px 10px;
    border: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
    color: #ffffff;
}

/* グループヘッダー行 */
.sales-grid .sg-group-row th {
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.5px;
    border-bottom: none;
}

.sg-corner {
    background: var(--surface-2) !important;
    color: var(--text-secondary) !important;
    text-align: center !important;
    font-weight: 600 !important;
    position: sticky;
    left: 0;
    z-index: 30;
    min-width: 80px;
}

/* サブヘッダー行 */
.sales-grid .sg-sub-row th {
    background: var(--surface-2);
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    padding: 4px 8px;
    position: sticky;
    top: 0;
    z-index: 20;
}

/* stickyヘッダー */
.sales-grid .sg-group-row th {
    position: sticky;
    top: 0;
    z-index: 20;
}
.sales-grid .sg-sub-row th {
    top: 33px;
}

/* 日付セル（sticky左列） */
.sg-date-cell {
    position: sticky;
    left: 0;
    z-index: 10;
    background: var(--surface) !important;
    font-weight: 600;
    text-align: left !important;
    min-width: 80px;
    border-right: 2px solid var(--border-hover) !important;
}

/* 合計行 */
.sg-total-row {
    background: rgba(99, 102, 241, 0.08) !important;
}

.sg-total-row td {
    font-weight: 700;
    color: var(--text-white);
    border-top: 2px solid var(--primary) !important;
    border-bottom: 2px solid var(--primary) !important;
}

.sg-total-row .sg-date-cell {
    background: rgba(99, 102, 241, 0.15) !important;
    color: var(--primary) !important;
}

.sg-total-label {
    font-weight: 700 !important;
}

.sg-total-val {
    font-weight: 600;
}

/* 合計列 */
.sg-grand-total {
    font-weight: 700 !important;
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.04);
    border-left: 2px solid rgba(239, 68, 68, 0.3) !important;
}

/* デリバリー合計列 */
.sg-delivery-total {
    color: #60a5fa !important;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.04);
}

/* 店頭合計列 */
.sg-store-total {
    color: #fbbf24 !important;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.04);
}

/* 合計ヘッダー */
.sg-total-header, .sg-delivery-header, .sg-store-total-header {
    font-weight: 700 !important;
    text-align: center !important;
    font-size: 11px !important;
}

/* ゼロ値 */
.sg-zero {
    color: #64748b !important;
    font-weight: 400 !important;
}

/* 日曜日 */
.sg-sunday .sg-date-cell {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.05) !important;
}

/* 土曜日 */
.sg-saturday .sg-date-cell {
    color: #3b82f6 !important;
    background: rgba(59, 130, 246, 0.05) !important;
}

/* 本日行 */
.sg-today {
    background: rgba(99, 102, 241, 0.06) !important;
}

.sg-today .sg-date-cell {
    background: rgba(99, 102, 241, 0.12) !important;
    color: var(--primary) !important;
}

/* 定休日行 */
.sg-closed {
    opacity: 0.4;
}

.sg-closed-cell {
    text-align: center !important;
    color: var(--text-dim);
    background: var(--surface-2);
}

/* データ行ホバー */
.sg-data-row:hover {
    background: var(--surface-2);
}

.sg-data-row:hover .sg-date-cell {
    background: var(--surface-3) !important;
}

/* グループ間の区切り線 */
.sales-grid td:nth-child(5),
.sales-grid th:nth-child(5) {
    border-right: 2px solid rgba(34, 197, 94, 0.2) !important;
}
.sales-grid td:nth-child(9),
.sales-grid th:nth-child(9) {
    border-right: 2px solid rgba(59, 130, 246, 0.2) !important;
}
.sales-grid td:nth-child(13),
.sales-grid th:nth-child(13) {
    border-right: 2px solid rgba(249, 115, 22, 0.2) !important;
}
.sales-grid td:nth-child(15),
.sales-grid th:nth-child(15) {
    border-right: 2px solid rgba(139, 92, 246, 0.2) !important;
}
.sales-grid td:nth-child(21),
.sales-grid th:nth-child(21) {
    border-right: 2px solid rgba(239, 68, 68, 0.2) !important;
}

/* イベントバナー（ダッシュボード） */
.event-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(16, 185, 129, 0.06));
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 10px;
    padding: 14px 20px;
    margin-bottom: 8px;
    animation: eventBannerFadeIn 0.4s ease;
}
.event-banner:last-child {
    margin-bottom: 0;
}
@keyframes eventBannerFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.event-banner-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: rgba(34, 197, 94, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4ade80;
    font-size: 16px;
}
.event-banner-body {
    flex: 1;
    min-width: 0;
}
.event-banner-title {
    font-size: 14px;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.event-banner-period {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}
.event-banner-link {
    flex-shrink: 0;
    color: #4ade80;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    padding: 6px 14px;
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}
.event-banner-link:hover {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
}
