@charset "UTF-8";

/*
 * ARC.Bridge 管理システム 共通デザイン
 *
 * ホーム画面（attendance_view.php）のデザインを共通化したもの。
 * 各ページは <body class="app-shell"> を付けたうえで、
 * partials/sidebar.php を読み込んで使用する。
 *
 * 注意：
 * 印刷・PDF出力の対象領域（#printArea など）はページ側のCSSで管理する。
 * 帳票の体裁が崩れるため、このファイルから印刷領域の中身に触れないこと。
 */

:root {
    --navy: #0f2744;
    --navy-2: #173b64;
    --blue: #2f78d0;
    --cyan: #3fc3d8;
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #6b778c;
    --line: #e5ebf3;
    --success: #159f73;
    --warning: #d88b16;
    --danger: #c9424f;
    --shadow: 0 12px 36px rgba(19, 45, 80, .08);
}

/* ============================================================
   ベース
   ============================================================ */

body.app-shell {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.app-shell * { box-sizing: border-box; }
.app-shell a { color: inherit; text-decoration: none; }
.app-shell a,
.app-shell button { -webkit-tap-highlight-color: rgba(47, 120, 208, .15); }
.app-shell button,
.app-shell input,
.app-shell select { font: inherit; }

.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    transition: grid-template-columns .22s ease;
}

/* ------------------------------------------------------------
   サイドバーの開閉
   状態は <html class="nav-hidden"> で持つ。
   描画前に partials/head_assets.php が付与するのでちらつかない。
   ------------------------------------------------------------ */

html.nav-hidden .app { grid-template-columns: minmax(0, 1fr); }
html.nav-hidden .sidebar { display: none; }

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

.nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    flex: none;
    width: 44px; height: 44px; /* タブレットのタップ領域 */
    color: var(--navy-2);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: 18px; line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(20, 48, 82, .05);
    transition: .18s ease;
}
.nav-toggle:hover { color: var(--blue); border-color: var(--cyan); }
.nav-toggle:active { transform: scale(.95); }

/* ============================================================
   サイドバー
   ============================================================ */

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px;
    color: #fff;
    background: linear-gradient(165deg, var(--navy) 0%, #102f52 58%, #17476e 100%);
    box-shadow: 12px 0 32px rgba(10, 31, 55, .12);
    overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 24px; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 13px;
    display: grid; place-items: center;
    font-weight: 800; letter-spacing: -1px;
    background: linear-gradient(135deg, var(--cyan), #6e8cff);
    box-shadow: 0 8px 24px rgba(63, 195, 216, .26);
}
.brand-name { font-size: 18px; font-weight: 750; letter-spacing: .02em; }
.brand-sub { font-size: 11px; color: rgba(255, 255, 255, .62); margin-top: 2px; }

.nav-label { margin: 22px 12px 8px; font-size: 11px; color: rgba(255, 255, 255, .48); letter-spacing: .12em; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 13px; margin: 4px 0; border-radius: 12px;
    color: rgba(255, 255, 255, .8); font-size: 14px; font-weight: 600;
    transition: .2s ease;
}
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .10); transform: translateX(2px); }
.nav-item.active { color: #fff; background: rgba(255, 255, 255, .14); box-shadow: inset 3px 0 0 var(--cyan); }
.nav-icon { width: 22px; text-align: center; font-size: 17px; }

.sidebar-footer { margin-top: 26px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .12); }
.legacy-link { font-size: 13px; color: rgba(255, 255, 255, .68); }

/* ============================================================
   メイン領域・トップバー
   ============================================================ */

.main { min-width: 0; padding: 0 34px 44px; }

.topbar {
    min-height: 82px;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    position: sticky; top: 0; z-index: 5;
    background: rgba(244, 247, 251, .88);
    -webkit-backdrop-filter: blur(16px); /* iPad Safari は接頭辞が必要 */
    backdrop-filter: blur(16px);
}

.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.breadcrumb a:hover { color: var(--blue); }
.breadcrumb .sep { color: #b7c2d1; }

.user { display: flex; align-items: center; gap: 11px; white-space: nowrap; }
.avatar {
    width: 40px; height: 40px; border-radius: 12px;
    display: grid; place-items: center; color: #fff; font-weight: 700;
    background: linear-gradient(135deg, var(--blue), var(--cyan));
}
.user-name { font-size: 13px; font-weight: 700; }
.user-role { font-size: 11px; color: var(--muted); margin-top: 2px; }

.mobile-header { display: none; }

/* ============================================================
   ページ見出し
   ============================================================ */

.page-head {
    position: relative; overflow: hidden;
    padding: 28px 30px; border-radius: 22px;
    color: #fff;
    background: linear-gradient(120deg, var(--navy-2), #245e91 63%, #2c88aa);
    box-shadow: var(--shadow);
}
.page-head::after {
    content: ""; position: absolute; width: 260px; height: 260px; right: -70px; top: -110px;
    border-radius: 50%; border: 42px solid rgba(255, 255, 255, .06);
}
.page-kicker { font-size: 12px; color: #9fe9f5; font-weight: 700; letter-spacing: .08em; }
.page-head h1 { margin: 8px 0 8px; font-size: 27px; letter-spacing: -.02em; }
.page-head p { margin: 0; color: rgba(255, 255, 255, .74); font-size: 14px; }

.quick-links { position: relative; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.quick-link {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 14px; border-radius: 11px;
    font-size: 13px; font-weight: 700;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .14);
    transition: .2s ease;
}
.quick-link:hover { background: #fff; color: var(--navy); transform: translateY(-1px); }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 30px 2px 14px; }
.section-head h2 { margin: 0; font-size: 17px; }
.section-head p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.section-meta { font-size: 12px; color: var(--muted); }

/* ============================================================
   集計カード・検索ボックス
   ============================================================ */

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: 0 7px 24px rgba(20, 48, 82, .045); }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-value { margin-top: 8px; font-size: 25px; font-weight: 800; color: var(--navy); }
@media (max-width: 1080px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px)  { .stats { grid-template-columns: 1fr; } }

.search { position: relative; }
.search input {
    width: 100%; min-height: 46px;
    padding: 12px 14px 12px 40px;
    background: #f9fbfd; border: 1px solid #cbd9e6; border-radius: 12px;
    outline: none; font: inherit; transition: .18s ease;
}
.search input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(47, 120, 208, .11); background: #fff; }
.search::before { content: "⌕"; position: absolute; left: 14px; top: 9px; font-size: 21px; color: #7c8ba0; pointer-events: none; }

/* ============================================================
   機能カード
   ============================================================ */

.modules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.module-card {
    position: relative; min-height: 150px; padding: 22px;
    background: var(--card); border: 1px solid var(--line); border-radius: 20px;
    box-shadow: 0 8px 28px rgba(20, 48, 82, .045);
    transition: .22s ease;
}
.module-card:hover { transform: translateY(-4px); box-shadow: 0 16px 38px rgba(20, 48, 82, .10); border-color: #cddced; }
.module-icon {
    width: 46px; height: 46px; display: grid; place-items: center;
    border-radius: 14px; font-size: 22px;
    background: linear-gradient(135deg, #edf5ff, #eefcff);
}
.module-card h3 { margin: 16px 0 7px; font-size: 16px; }
.module-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.module-arrow { position: absolute; right: 20px; bottom: 18px; color: #9aabc0; transition: .2s ease; }
.module-card:hover .module-arrow { color: var(--blue); transform: translateX(3px); }

@media (max-width: 1080px) { .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px)  { .modules { grid-template-columns: 1fr; } }

/* ============================================================
   パネル
   ============================================================ */

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 8px 28px rgba(20, 48, 82, .04);
}
.panel + .panel { margin-top: 16px; }

/*
 * 帳票を載せるパネル。左右の余白を詰めることで、iPad Pro 11インチ横
 * （幅1194px）以上のときに 287mm(1085px) の帳票が横スクロールなしで
 * 収まるようにする。帳票自身の寸法は変更しない。
 */
.panel-sheet { padding: 16px 8px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-head h3 { margin: 0; font-size: 15px; }

/* ============================================================
   フォーム
   ============================================================ */

.field-grid { display: flex; flex-wrap: wrap; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-wide { flex: 1 1 320px; }
.field-label { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }

.app-shell select,
.app-shell input[type="date"],
.app-shell input[type="text"] {
    min-height: 44px;
    padding: 9px 12px;
    color: var(--text);
    background: #fff;
    border: 1px solid #bcccdc;
    border-radius: 10px;
    outline: none;
    transition: .18s ease;
}
.app-shell select:focus,
.app-shell input[type="date"]:focus,
.app-shell input[type="text"]:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(47, 120, 208, .11);
}
.app-shell select { max-width: 100%; }

.date-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-range .tilde { color: var(--muted); }

/* ============================================================
   ボタン
   ============================================================ */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-height: 44px;
    padding: 10px 17px;
    color: var(--navy-2);
    background: #fff;
    border: 1px solid #c8d8e4;
    border-radius: 11px;
    font-size: 13px; font-weight: 700; white-space: nowrap;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.btn:hover:not(:disabled) { border-color: var(--cyan); box-shadow: 0 5px 16px rgba(0, 168, 198, .14); transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: .75; }

.btn-primary { color: #fff; background: linear-gradient(135deg, var(--blue), #2360ac); border-color: transparent; }
.btn-primary:hover:not(:disabled) { box-shadow: 0 7px 20px rgba(47, 120, 208, .28); }

.btn-danger { color: #fff; background: linear-gradient(135deg, #d85560, var(--danger)); border-color: transparent; }
.btn-danger:hover:not(:disabled) { box-shadow: 0 7px 20px rgba(201, 66, 79, .26); }
.btn-danger:disabled { background: var(--success); opacity: 1; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* 期間指定などの補助ボタン群 */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; /* タブレットのタップ領域として 44px を確保する */
    padding: 10px 18px;
    color: var(--navy-2);
    background: #f2f7fc;
    border: 1px solid #d3e1ef;
    border-radius: 999px;
    font-size: 13px; font-weight: 700; white-space: nowrap;
    cursor: pointer;
    transition: .18s ease;
}
.chip:hover { color: #fff; background: linear-gradient(135deg, var(--blue), #2360ac); border-color: transparent; }
.chip:hover .chip-count { color: #fff; background: rgba(255, 255, 255, .22); }

/* 選択中のフィルタ */
.chip.active { color: #fff; background: linear-gradient(135deg, var(--blue), #2360ac); border-color: transparent; }
.chip.active .chip-count { color: #fff; background: rgba(255, 255, 255, .22); }

/* チップ内の件数バッジ */
.chip-count {
    padding: 2px 8px; border-radius: 999px;
    color: var(--muted); background: #fff;
    font-size: 11px; font-weight: 700;
    transition: .18s ease;
}

/* ============================================================
   ログイン画面
   サイドバーを持たないため .app は使わない
   ============================================================ */

body.auth-shell {
    display: grid; place-items: center; min-height: 100vh; padding: 24px;
    background: linear-gradient(165deg, var(--navy) 0%, #102f52 55%, #17476e 100%);
}
.auth-card {
    width: 100%; max-width: 400px;
    padding: 34px 30px;
    background: var(--card);
    border-radius: 22px;
    box-shadow: 0 28px 70px rgba(6, 22, 42, .38);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-card h1 { margin: 0 0 6px; font-size: 20px; }
.auth-card .auth-desc { margin: 0 0 22px; font-size: 13px; color: var(--muted); }
.auth-card .field { margin-bottom: 14px; }
.auth-card input[type="text"],
.auth-card input[type="password"] {
    width: 100%; min-height: 46px; padding: 10px 13px;
    color: var(--text); background: #fff;
    border: 1px solid #bcccdc; border-radius: 11px;
    outline: none; font: inherit; transition: .18s ease;
}
.auth-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(47, 120, 208, .11); }
.auth-card .btn { width: 100%; margin-top: 8px; }

/* ============================================================
   一覧表
   ============================================================ */

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
/* 列が潰れて文字が縦積みになるのを防ぐ。溢れた分は .scroll-x が横スクロールで受ける */
.scroll-x > .data-table { min-width: 820px; }
.data-table td { white-space: nowrap; }
.data-table td.wrap { white-space: normal; }
.data-table th,
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data-table thead th {
    position: sticky; top: 0; z-index: 1;
    color: #fff; background: var(--navy-2);
    font-size: 12px; font-weight: 700; letter-spacing: .03em;
    white-space: nowrap;
}
.data-table thead th:first-child { border-top-left-radius: 12px; }
.data-table thead th:last-child { border-top-right-radius: 12px; }
.data-table tbody tr:hover td { background: #f5f9fe; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table td.center { text-align: center; }
.data-table .sub { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }
.data-table form { display: inline; }

.empty { padding: 34px 12px; text-align: center; color: var(--muted); font-size: 13px; }

/* ============================================================
   縦積みフォーム
   ============================================================ */

.form-stack { display: grid; gap: 16px; max-width: 640px; }
.form-stack.wide { max-width: none; }
.form-stack .field { gap: 7px; }
.form-stack input[type="email"],
.form-stack input[type="number"],
.form-stack input[type="tel"],
.form-stack textarea {
    min-height: 44px; padding: 9px 12px;
    color: var(--text); background: #fff;
    border: 1px solid #bcccdc; border-radius: 10px;
    outline: none; font: inherit; transition: .18s ease;
}
.form-stack textarea { min-height: 96px; resize: vertical; }
.form-stack input:focus,
.form-stack textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(47, 120, 208, .11); }
.form-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-cols .field-full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-cols { grid-template-columns: 1fr; } }

/* ============================================================
   アコーディオン
   ============================================================ */

.accordion { margin-bottom: 12px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--card); box-shadow: 0 8px 28px rgba(20, 48, 82, .04); }
.accordion-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    width: 100%; min-height: 54px; padding: 14px 20px;
    color: #fff; background: linear-gradient(135deg, var(--navy-2), #245e91);
    border: 0; cursor: pointer;
    font-size: 15px; font-weight: 700; text-align: left;
}
.accordion-header:hover { filter: brightness(1.08); }
.accordion-mark { font-size: 18px; opacity: .85; }
.accordion-content { display: none; padding: 20px; }

/* ============================================================
   タブ風の切り替えリンク・バッジ
   ============================================================ */

.two-column { display: grid; grid-template-columns: minmax(320px, .9fr) minmax(0, 1.6fr); gap: 16px; align-items: start; }
.two-column > .panel + .panel { margin-top: 0; }
@media (max-width: 1080px) { .two-column { grid-template-columns: 1fr; } }

.money { text-align: right; font-variant-numeric: tabular-nums; }

.total-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    margin-top: 20px; padding: 17px 20px;
    background: #edf5ff; border: 1px solid #c9def5; border-radius: 15px;
    font-size: 13px; font-weight: 700; color: var(--muted);
}
.total-bar strong { font-size: 24px; color: var(--navy); }

.check { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; font-size: 13px; font-weight: 650; cursor: pointer; }
.check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue); }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tab {
    display: inline-flex; align-items: center; min-height: 40px;
    padding: 8px 16px; border-radius: 999px;
    color: var(--muted); background: #fff; border: 1px solid var(--line);
    font-size: 13px; font-weight: 700; transition: .18s ease;
}
.tab:hover { color: var(--blue); border-color: #c4daf2; }
.tab.active { color: #fff; background: linear-gradient(135deg, var(--blue), #2360ac); border-color: transparent; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-success { color: var(--success); background: #eaf8f3; }
.badge-muted { color: var(--muted); background: #eef2f7; }
.badge-warning { color: var(--warning); background: #fdf3e3; }

.btn-sm { min-height: 36px; padding: 7px 13px; font-size: 12px; border-radius: 9px; }

/* ============================================================
   通知
   ============================================================ */

.alert { padding: 14px 20px; border-radius: 13px; font-size: 14px; font-weight: 650; margin-bottom: 16px; }
.alert-success { color: #0f6848; background: #e8f8f1; border: 1px solid #b8e5d2; }
.alert-error { color: #8f2c36; background: #fdeef0; border: 1px solid #f3ccd2; }

/* ============================================================
   横スクロール領域
   帳票（#printArea）を画面幅に収めるための入れ物。
   帳票自身の寸法は変更しないので、印刷・PDFの体裁に影響しない。
   ============================================================ */

.scroll-x { overflow-x: auto; padding-bottom: 4px; }

/* ============================================================
   レスポンシブ
   ============================================================ */

/* iPad 縦向き（768〜834px）はサイドバーが幅を取りすぎるため少し細くする */
@media (min-width: 761px) and (max-width: 1100px) {
    .app { grid-template-columns: 224px minmax(0, 1fr); }
    .sidebar { padding: 20px 14px; }
    .nav-item { padding: 12px 11px; font-size: 13px; }
    .main { padding: 0 22px 36px; }
    .page-head { padding: 24px 24px; }
    .page-head h1 { font-size: 24px; }
}

@media (max-width: 1080px) {
    .main { padding: 0 22px 36px; }
}

@media (max-width: 760px) {
    .app { display: block; }
    /* 狭い画面では既定で非表示だが、開いたときは上部に積んで表示する */
    .sidebar { position: static; height: auto; margin-bottom: 16px; border-radius: 0 0 20px 20px; }
    .main { padding: 0 16px 28px; }
    .mobile-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 2px 8px; }
    .mobile-brand { font-weight: 800; color: var(--navy); }
    .topbar { min-height: 0; padding: 8px 0 14px; position: static; }
    .user { display: none; }
    .page-head { padding: 24px 20px; border-radius: 18px; }
    .page-head h1 { font-size: 22px; }
    .panel { padding: 16px; border-radius: 16px; }
    .field-grid { gap: 14px; }
    .field-wide { flex-basis: 100%; }
}

/* ============================================================
   印刷
   画面用の装飾のみを隠す。帳票側のCSSはページ側で定義する。
   ============================================================ */

@media print {
    body.app-shell { background: #fff; padding: 0; margin: 0; }
    .app { display: block; }
    .sidebar,
    .topbar,
    .mobile-header,
    .page-head,
    .section-head,
    .no-print { display: none !important; }
    .main { padding: 0; }
    .panel { padding: 0; border: 0; border-radius: 0; box-shadow: none; }
    .panel + .panel { margin-top: 0; }
    .scroll-x { overflow: visible; padding: 0; }
}
