body { font-family: "Helvetica Neue", Arial, sans-serif; margin: 0; background: #f4f4f4; color: #333; }

/* ヘッダー */
header {
    background: #2c3e50;
    color: #fff;
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.header-title h1 { margin: 0; font-size: 1.5rem; font-weight: bold; }
.nav-control { display: flex; justify-content: space-between; align-items: center; width: 100%; flex-wrap: wrap; gap:10px;}
header a { color: #fff; text-decoration: none; padding: 6px 12px; border-radius: 4px; font-size: 0.9rem; transition: background 0.2s; }
header a:hover { background: #34495e; }
header a.active { background: #3498db; font-weight: bold; }

.btn-nav { background: #444; color: white; text-decoration: none; padding: 5px 10px; border-radius: 4px; display: inline-block; }
.date-picker { padding: 5px; border-radius: 4px; border: none; }

/* ログイン・QR登録 (中央揃えのまま維持) */
.login-body, .register-body { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    min-height: 100vh; 
    background: #e0e0e0; 
    padding: 20px; 
    box-sizing: border-box;
}

/* Web予約 (上寄せに変更) */
.booking-body { 
    display: flex; 
    justify-content: center; 
    align-items: flex-start; /* 上揃え */
    min-height: 100vh; 
    background: #e0e0e0; 
    padding: 40px 20px; /* 上に少し余白を追加 */
    box-sizing: border-box;
}

.login-box, .booking-box, .register-box { background: white; padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); width: 100%; max-width: 400px; }
.booking-box { max-width: 600px; }
.login-box h2, .booking-box h2, .register-box h2 { margin-top: 0; text-align: center; color: #2c3e50; margin-bottom: 20px;}

/* タブレット専用スタイル (全画面) */
.tablet-body {
    margin: 0;
    padding: 0;
    background: white;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* 上寄せ */
}
.tablet-box {
    width: 100%;
    height: 100%;
    max-width: none; /* 幅制限解除 */
    border-radius: 0;
    box-shadow: none;
    padding: 40px; /* 余白を広めに */
    box-sizing: border-box;
    overflow-y: auto; /* コンテンツが多い場合はスクロール */
}
.tablet-box h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

/* フォーム共通 */
form label { display: block; margin-bottom: 5px; font-weight: bold; font-size: 0.9em; margin-top: 10px;}
input, select, textarea { padding: 10px; width: 100%; box-sizing: border-box; border: 1px solid #ddd; border-radius: 4px; margin-bottom: 10px; }
button { cursor: pointer; padding: 10px; border-radius: 4px; font-weight: bold; }
.btn-primary { background: #3498db; color: white; border: none; width: 100%; font-size: 1.1em; margin-top: 10px;}
.btn-primary:hover { background: #2980b9; }

/* 管理画面コンテナ */
section { background: white; margin: 20px auto; padding: 20px; border-radius: 5px; max-width: 1200px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
ul { list-style: none; padding: 0; }
li { padding: 10px 0; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }

/* Dashboard 上部エリア（時間未定・順番待ち） */
.dashboard-top-area { background: #e8f4fa; padding: 15px 20px; border-bottom: 1px solid #bcd; display: flex; flex-direction: column; gap: 15px; }
.dashboard-row { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.dashboard-label { font-weight: bold; color: #2c3e50; min-width: 100px; }
.btn-store-list { 
    background: #fff; border: 1px solid #3498db; color: #3498db; 
    padding: 8px 15px; border-radius: 20px; font-size: 0.9rem; 
    transition: all 0.2s; display: flex; align-items: center; gap: 5px;
}
.btn-store-list:hover { background: #3498db; color: white; }
.btn-store-list .badge { background: #e74c3c; color: white; border-radius: 50%; padding: 2px 6px; font-size: 0.75rem; min-width: 15px; text-align: center; }
.btn-store-list.queue-btn { border-color: #e67e22; color: #e67e22; }
.btn-store-list.queue-btn:hover { background: #e67e22; color: white; }

/* 完了・履歴ボタン */
.btn-store-list.history-btn { border-color: #7f8c8d; color: #7f8c8d; }
.btn-store-list.history-btn:hover { background: #7f8c8d; color: white; }
.btn-store-list.history-btn .badge { background: #555; }

/* 時間未定・順番待ちカード */
.undecided-card { 
    background: white; padding: 10px; border: 1px solid #bdc3c7; border-left: 4px solid #f39c12;
    border-radius: 4px; cursor: pointer; width: 100%; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: transform 0.1s; margin-bottom: 10px; box-sizing: border-box;
}
.undecided-card:hover { transform: translateY(-2px); box-shadow: 0 3px 6px rgba(0,0,0,0.1); }
.undecided-card.done { text-decoration: line-through; opacity: 0.6; border-left-color: #7f8c8d; }
.card-top { display: flex; justify-content: space-between; font-size: 0.75rem; margin-bottom: 5px; }
.badge-store { background: #ecf0f1; padding: 2px 4px; border-radius: 2px; color: #333; }
.badge-item { color: #2980b9; font-weight: bold; }
.card-name { font-weight: bold; margin-bottom: 5px; color: #2c3e50; }
.card-info { font-size: 0.8rem; color: #7f8c8d; }

/* 完了済みカード */
.completed-card {
    background: #f9f9f9; padding: 10px; border: 1px solid #ddd; border-left: 4px solid #7f8c8d;
    border-radius: 4px; cursor: pointer; width: 100%; margin-bottom: 10px; box-sizing: border-box;
}
.completed-card:hover { background: #eee; }
.completed-card.status-canceled { border-left-color: #c0392b; background: #fff0f0; }

/* 順番待ちボタン（グリッド） */
.queue-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.queue-btn-item {
    width: 60px; height: 60px; border-radius: 50%; border: 2px solid #e67e22;
    background: #fff; color: #e67e22; font-weight: bold; font-size: 1.2rem;
    display: flex; justify-content: center; align-items: center; cursor: pointer;
    transition: all 0.2s; position: relative;
}
.queue-btn-item:hover { background: #e67e22; color: white; }
.queue-btn-item.has-name { background: #fff3e0; } /* 名前入力済み */
.queue-btn-item .q-badge { 
    position: absolute; top: -5px; right: -5px; width: 10px; height: 10px; 
    background: #e74c3c; border-radius: 50%; display: none; 
}
.queue-btn-item.unregistered .q-badge { display: block; background: #ccc; } /* 未登録 */

/* スケジュール */
.schedule-wrapper { width: 100%; overflow-x: auto; }
.schedule-container { display: flex; background: white; width: 100%; min-width: 100%; }

.time-column { width: 60px; flex-shrink: 0; border-right: 1px solid #ddd; background: #fafafa; position: sticky; left: 0; z-index: 50; }
.time-header { height: 40px; background: #eee; border-bottom: 1px solid #ddd; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 0.8rem; }
.time-slot { height: 60px; border-bottom: 1px dashed #eee; font-size: 11px; text-align: right; padding-right: 8px; padding-top: 2px; box-sizing: border-box; color: #777; }
.time-slot-sub { height: 60px; border-bottom: 1px solid #ddd; }

/* 店舗・ブース列 */
.store-group { border-right: 2px solid #aaa; display: flex; flex-direction: column; flex: 1; }
.store-group-header { text-align: center; background: #dfe6e9; padding: 5px; font-weight: bold; border-bottom: 1px solid #ccc; color: #2c3e50; }
.booth-container { display: flex; flex: 1; }
.store-column { flex: 1; min-width: 150px; border-right: 1px solid #ddd; position: relative; }
.store-header { height: 30px; text-align: center; background: #f8f9fa; border-bottom: 1px solid #ddd; font-weight: normal; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; color: #555; }
.store-body { position: relative; height: 1200px; background: #fff; }

.grid-line { height: 59px; border-bottom: 1px dashed #f0f0f0; cursor: pointer; transition: background 0.1s; }
.grid-line-sub { height: 59px; border-bottom: 1px solid #eee; cursor: pointer; transition: background 0.1s; }
.grid-line:hover, .grid-line-sub:hover { background: #e8f6ff; }
.grid-line.closed, .grid-line-sub.closed { background: #f0f0f0; cursor: not-allowed; }

.res-block {
    position: absolute; left: 2px; right: 2px;
    background: #d6eaf8; border: 1px solid #5dade2; border-left: 4px solid #3498db;
    border-radius: 3px;
    padding: 2px 4px; font-size: 10px; overflow: hidden; cursor: pointer;
    opacity: 0.95; z-index: 10;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: z-index 0s, box-shadow 0.2s;
    line-height: 1.2;
}
.res-block:hover { z-index: 100; box-shadow: 0 4px 8px rgba(0,0,0,0.2); height: auto !important; min-height: fit-content; }
.res-block.done { background: #ecf0f1; border-color: #bdc3c7; border-left-color: #7f8c8d; text-decoration: line-through; color: #7f8c8d; }
.res-time { font-weight: bold; margin-bottom: 0px; font-size: 9px; }
.res-name { font-size: 11px; font-weight: bold; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.res-item { font-size: 9px; color: #333; }

/* カレンダー */
.calendar-container { padding: 20px; max-width: 1200px; margin: 0 auto; }
.calendar-title { text-align: center; color: #2c3e50; margin-bottom: 20px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: #ddd; border: 1px solid #ddd; }
.calendar-grid div { background: white; }
.cw { text-align: center; padding: 10px; font-weight: bold; background: #eee; }
.day-cell { height: 120px; padding: 5px; position: relative; transition: background 0.2s; }
.day-cell:hover { background: #f9f9f9; }
.day-cell.today { background: #fff9e6; }
.day-cell a { display: block; height: 100%; text-decoration: none; color: inherit; }
.day-num { display: block; font-weight: bold; font-size: 1.1rem; margin-bottom: 5px; }
.res-badge { display: inline-block; background: #3498db; color: white; font-size: 11px; padding: 3px 6px; border-radius: 10px; }

/* モーダル */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 200; overflow-y: auto; }
.modal-content { background: white; margin: 5% auto; padding: 25px; width: 350px; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.modal-content.list-modal { width: 500px; max-width: 95%; } /* 一覧用モーダルは少し広めに */
.close { float: right; font-size: 28px; cursor: pointer; color: #aaa; }
.close:hover { color: #333; }
.btn-group { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 5px; }
.btn-del { background: #c0392b; color: white; border: none; flex: 1; min-width: 80px;}
.btn-save { background: #2980b9; color: white; border: none; flex: 2; min-width: 100px;}
.btn-toggle { background: #f39c12; color: white; border: none; flex: 1.5; font-size: 0.8rem; min-width: 100px;}
.btn-notify { background: #8e44ad; color: white; border: none; width: 100%; margin-top: 5px; padding: 8px; font-size: 0.9rem; cursor: pointer; border-radius: 4px;}
.btn-quick { background: #34495e; color: white; border: none; flex: 2; font-size: 0.9rem; min-width: 120px;}

/* 混雑状況ウィジェット */
.widget-container { font-family: sans-serif; border: 1px solid #ddd; padding: 10px; border-radius: 5px; background: white; max-width: 300px; }
.widget-store { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid #eee; }
.widget-store:last-child { border: none; margin: 0; padding: 0; }
.widget-name { font-weight: bold; font-size: 1.1em; color: #2c3e50; }
.widget-status { float: right; font-weight: bold; }
.status-vacant { color: #27ae60; }
.status-crowded { color: #f39c12; }
.status-full { color: #c0392b; }
.status-closed { color: #95a5a6; }

/* ウィジェット用ボタン */
.btn-widget {
    display: inline-block;
    background-color: #3498db;
    color: #fff !important;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    transition: background 0.3s;
    font-size: 0.9em;
}
.btn-widget:hover {
    background-color: #2980b9;
}

/* Kiosk (順番受付) スタイル */
.kiosk-body {
    font-family: sans-serif; background: #ecf0f1; height: 100vh; display: flex; flex-direction: column;
    justify-content: center; align-items: center; padding: 20px; box-sizing: border-box;
}
.kiosk-box {
    background: white; padding: 40px; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    width: 100%; max-width: 600px; text-align: center;
}
.kiosk-title { font-size: 2.5rem; color: #2c3e50; margin-bottom: 10px; font-weight: bold; }
.kiosk-store { font-size: 1.5rem; color: #7f8c8d; margin-bottom: 40px; border-bottom: 2px solid #eee; padding-bottom: 20px; }
.btn-kiosk-issue {
    background: #e67e22; color: white; border: none; border-radius: 10px;
    font-size: 2.5rem; padding: 30px 60px; cursor: pointer; box-shadow: 0 6px 0 #d35400;
    transition: transform 0.1s, box-shadow 0.1s; width: 100%;
}
.btn-kiosk-issue:active { transform: translateY(6px); box-shadow: 0 0 0 #d35400; }

.ticket-view { text-align: center; }
.ticket-num-label { font-size: 1.2rem; color: #555; margin-bottom: 10px; }
.ticket-number { font-size: 6rem; font-weight: bold; color: #2c3e50; line-height: 1; margin-bottom: 20px; }
.ticket-date { font-size: 1.2rem; color: #7f8c8d; margin-bottom: 30px; }
.ticket-qr-area { margin: 20px auto; padding: 10px; background: white; display: inline-block; border: 1px solid #ddd; }
.ticket-instruction { text-align: left; background: #f9f9f9; padding: 15px; border-radius: 8px; margin-top: 20px; font-size: 1.1rem; line-height: 1.6; }

/* カレンダーウィジェット */
.wc-wrapper { padding: 5px; box-sizing: border-box; font-family: sans-serif;}
.wc-store { margin-bottom: 20px; background: #fff; border: 1px solid #ddd; border-radius: 5px; padding: 10px; }
.wc-store-name { text-align: center; font-weight: bold; color: #2c3e50; margin-bottom: 5px; font-size: 1.1em; border-bottom: 2px solid #eee; padding-bottom: 5px; }
.wc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; font-size: 0.9em; }
.wc-nav { text-decoration: none; color: #3498db; font-weight: bold; cursor: pointer; padding: 2px 5px; }
.wc-nav:hover { background: #eee; border-radius: 3px; }
.wc-title { font-weight: bold; }
.wc-table { width: 100%; border-collapse: collapse; font-size: 0.85em; table-layout: fixed; }
.wc-table th { background: #f0f0f0; color: #555; padding: 3px 0; font-weight: normal; }
.wc-table td { text-align: center; padding: 5px 0; border-bottom: 1px solid #f9f9f9; vertical-align: middle; }
.wc-day { display: block; width: 24px; height: 24px; line-height: 24px; margin: 0 auto; border-radius: 50%; }
.st-closed .wc-day { background: #ffebee; color: #c0392b; font-weight: bold; }
.st-open .wc-day { color: #2c3e50; }
.th-sun { color: #e74c3c !important; }
.th-sat { color: #3498db !important; }
.is-sun .wc-day, .is-hol .wc-day { color: #e74c3c; }
.is-sat .wc-day { color: #3498db; }
.wc-legend { display: flex; justify-content: flex-end; gap: 10px; font-size: 0.75em; margin-top: 5px; color: #666; }
.wc-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; margin-right: 2px; }
.dot-closed { background: #ffebee; border: 1px solid #c0392b; }
.dot-open { border: 1px solid #ccc; }

/* 印刷用スタイル */
@media print {
    body * { visibility: hidden; }
    #printable-area, #printable-area * { visibility: visible; }
    #printable-area { position: absolute; left: 0; top: 0; width: 58mm; padding: 0; margin: 0; text-align: center; border: none; }
    .ticket-view { text-align: center; width: 100%; }
    .ticket-num-label { font-size: 10pt; margin-bottom: 5px; }
    .ticket-number { font-size: 40pt; font-weight: bold; margin: 5px 0; line-height: 1; }
    .ticket-date { font-size: 8pt; margin-bottom: 10px; }
    .ticket-qr-area img { width: 120px; height: 120px; }
    .ticket-instruction { font-size: 8pt; text-align: left; padding: 5px; border: 1px solid #000; margin-top: 10px;}
    .btn-primary, .btn-kiosk-issue, p { display: none !important; }
}
}