/* お弁当発注管理 — モバイルファーストCSS */
:root {
    --navy: #003894;
    --navy-light: #1a5fc7;
    --cream: #FAF094;
    --white: #ffffff;
    --gray-light: #f5f5f5;
    --gray: #999;
    --text: #333;
    --danger: #d32f2f;
    --success: #2e7d32;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    background: var(--gray-light);
    color: var(--text);
    min-height: 100vh;
}

/* ヘッダー */
.header {
    background: var(--navy);
    color: var(--white);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header h1 { font-size: 16px; font-weight: 600; }
.header .user-info { font-size: 13px; opacity: 0.85; }
.header a { color: var(--white); text-decoration: none; font-size: 13px; }
.user-name-badge {
    background: var(--cream);
    color: var(--navy);
    font-weight: 700;
    font-size: 14px;
    padding: 4px 14px;
    border-radius: 20px;
}
.logout-link {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 12px;
    margin-left: 8px;
}
.logout-link:hover { color: var(--white); }

/* ナビゲーション */
.nav {
    background: var(--white);
    display: flex;
    border-bottom: 1px solid #ddd;
    overflow-x: auto;
}
.nav a {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
    text-decoration: none;
    color: var(--gray);
    font-size: 13px;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
}
.nav a.active {
    color: var(--navy);
    border-bottom-color: var(--navy);
    font-weight: 600;
}

/* メインコンテンツ */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}

/* カード */
.card {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.card h2 {
    font-size: 15px;
    color: var(--navy);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--cream);
}

/* 日付表示 */
.date-display {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 4px;
}
.cutoff-info {
    text-align: center;
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 16px;
}
.cutoff-info.closed { color: var(--danger); font-weight: 600; }

/* メニュー選択ボタン */
.menu-select {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}
.menu-btn {
    flex: 1;
    padding: 16px 8px;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: var(--white);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    font-size: 14px;
}
.menu-btn:hover { border-color: var(--navy-light); }
.menu-btn.selected {
    border-color: var(--navy);
    background: #eef3fb;
}
.menu-btn .menu-name { font-weight: 600; font-size: 15px; display: block; margin-bottom: 4px; }
.menu-btn .menu-shop { font-size: 11px; color: var(--gray); }

/* ご飯サイズ */
.rice-select {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.rice-btn {
    padding: 10px 4px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: var(--white);
    cursor: pointer;
    text-align: center;
    font-size: 13px;
    transition: all 0.2s;
}
.rice-btn:hover { border-color: var(--navy-light); }
.rice-btn.selected {
    border-color: var(--navy);
    background: #eef3fb;
}

/* ボタン */
.btn {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-secondary { background: #e0e0e0; color: var(--text); }
.btn-small { display: inline-block; width: auto; padding: 6px 14px; font-size: 13px; border-radius: 6px; }

/* 現在の注文状態 */
.current-order {
    background: #eef3fb;
    border: 2px solid var(--navy);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
    margin-bottom: 16px;
}
.current-order .status { font-size: 13px; color: var(--navy); margin-bottom: 4px; }
.current-order .detail { font-size: 18px; font-weight: 600; }

/* メッセージ */
.message {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    text-align: center;
}
.message.success { background: #e8f5e9; color: var(--success); }
.message.error { background: #ffebee; color: var(--danger); }
.message.info { background: #e3f2fd; color: var(--navy); }

/* フォーム */
input[type="text"], input[type="password"], select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 12px;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--navy);
    box-shadow: 0 0 0 2px rgba(0,56,148,0.15);
}
label {
    display: block;
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 4px;
}

/* テーブル */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--navy); color: var(--white); padding: 8px; text-align: left; }
td { padding: 8px; border-bottom: 1px solid #eee; }
tr:hover { background: #fafafa; }

/* 履歴リスト */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}
.history-item:last-child { border-bottom: none; }
.history-date { font-size: 13px; color: var(--gray); }
.history-menu { font-weight: 600; }
.history-price { color: var(--navy); font-weight: 600; }

/* ユーザーリスト（代理注文） */
.user-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

/* ログイン画面 */
.login-container {
    max-width: 360px;
    margin: 60px auto;
    padding: 16px;
}
.login-logo {
    text-align: center;
    margin-bottom: 24px;
}
.login-logo h1 { color: var(--navy); font-size: 20px; }
.login-logo p { color: var(--gray); font-size: 13px; margin-top: 4px; }

/* 管理画面 */
.admin-section { margin-bottom: 24px; }
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.stat-box {
    text-align: center;
    padding: 12px;
    background: var(--gray-light);
    border-radius: 8px;
}
.stat-box .number { font-size: 24px; font-weight: 700; color: var(--navy); }
.stat-box .label { font-size: 11px; color: var(--gray); }

/* 毎日注文バナー */
.daily-mode-banner {
    background: linear-gradient(135deg, #eef3fb 0%, #e3f2fd 100%);
    border: 2px solid var(--navy);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    margin-bottom: 16px;
}
.daily-mode-status {
    font-size: 14px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.daily-mode-detail {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}
.daily-mode-note {
    font-size: 12px;
    color: var(--gray);
}

/* 日付スクロール */
.date-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 0 8px;
    -webkit-overflow-scrolling: touch;
}
.date-scroll::-webkit-scrollbar { height: 4px; }
.date-scroll::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }
.date-chip {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 12px;
    min-width: 48px;
    position: relative;
    transition: all 0.2s;
}
.date-chip:hover { border-color: var(--navy-light); }
.date-chip.selected {
    border-color: var(--navy);
    background: #eef3fb;
    font-weight: 600;
}
.date-chip.today .date-chip-day { color: var(--navy); font-weight: 700; }
.date-chip-day { font-size: 13px; }
.date-chip-week { font-size: 10px; color: var(--gray); }
.date-chip-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    position: absolute;
    top: 4px;
    right: 4px;
}

/* サブテキストリンク */
.link-subtle {
    color: var(--gray);
    font-size: 13px;
    text-decoration: underline;
}

/* フッター */
.app-footer {
    max-width: 480px;
    margin: 24px auto 0;
    padding: 0 16px 24px;
}
.footer-rules {
    background: var(--white);
    border-radius: 12px;
    padding: 16px;
    font-size: 12px;
    color: var(--gray);
    line-height: 1.8;
}
.footer-rules .footer-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}
.footer-rules ul {
    padding-left: 18px;
    margin: 0;
}
.footer-rules li { margin-bottom: 2px; }
.footer-rules strong { color: var(--text); }
