/* =====================================================
   クルーズ準備 — Art Deco Ocean Liner Theme
   ===================================================== */

:root {
    /* deep ocean midnight palette */
    --c-night: #08151f;
    --c-deep: #0c2236;
    --c-deep2: #122e44;
    --c-deep3: #173b56;
    /* brass / gold accents */
    --c-brass: #c9a36a;
    --c-brass-bright: #e6c485;
    --c-brass-dim: #8a6c40;
    /* ivory / cream */
    --c-ivory: #f4ecd8;
    --c-ivory-dim: #d4cbb6;
    /* secondary accents */
    --c-coral: #d35e4a;
    --c-seafoam: #6ba8a3;
    --c-text: #f4ecd8;
    --c-text-dim: rgba(244, 236, 216, 0.62);
    --c-text-faint: rgba(244, 236, 216, 0.4);
    /* legacy aliases (kept for any leftover refs) */
    --c-foam: var(--c-ivory);
    --c-wave: var(--c-brass);
    --c-shallow: var(--c-brass-bright);
    --c-sand: var(--c-ivory);
    --c-sunset: var(--c-coral);
    --c-text-light: var(--c-text);
    --c-text-dark: var(--c-night);

    --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    --rule-gold: 1px solid var(--c-brass);
    --rule-gold-dim: 1px solid rgba(201, 163, 106, 0.35);

    --font-display: 'Cinzel', 'Shippori Mincho', serif;
    --font-japanese: 'Shippori Mincho', 'Noto Serif JP', serif;
    --font-body: 'Lora', 'Noto Serif JP', serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    color: var(--c-text);
    min-height: 100vh;
    background-color: var(--c-night);
    background-image:
        radial-gradient(ellipse at top, #1a3a52 0%, #0c2236 45%, #08151f 100%),
        repeating-linear-gradient(135deg,
            transparent 0,
            transparent 80px,
            rgba(201, 163, 106, 0.025) 80px,
            rgba(201, 163, 106, 0.025) 81px);
    background-attachment: fixed;
}

/* film grain overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.07;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: 0.12em;
    margin: 0;
}

a { color: var(--c-brass-bright); text-decoration: none; }
a:hover { color: var(--c-ivory); }

/* ============ シェル / ヘッダ ============ */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 2;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background:
        linear-gradient(180deg, rgba(8, 21, 31, 0.85), rgba(12, 34, 54, 0.7));
    border-bottom: var(--rule-gold);
    box-shadow: 0 2px 0 0 rgba(201, 163, 106, 0.15), 0 12px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    position: relative;
}
.app-header::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--c-brass);
    opacity: 0.4;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}
.brand-mark {
    font-size: 1.6rem;
    color: var(--c-brass-bright);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}
.brand-text-wrap {
    display: flex;
    flex-direction: column;
    line-height: 1;
    gap: 4px;
}
.brand-overline {
    font-family: var(--font-display);
    font-size: 0.62rem;
    letter-spacing: 0.45em;
    color: var(--c-brass);
    text-transform: uppercase;
}
.brand-text {
    font-family: var(--font-japanese);
    font-size: 1.25rem;
    letter-spacing: 0.18em;
    color: var(--c-ivory);
    font-weight: 700;
}

.user-area {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    font-family: var(--font-japanese);
    font-size: 0.9rem;
}
.user-name {
    color: var(--c-ivory);
    letter-spacing: 0.05em;
}
.logout-link {
    color: var(--c-brass);
    text-decoration: none;
    border: 1px solid var(--c-brass);
    padding: 0.35rem 0.95rem;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-family: var(--font-display);
    transition: all 0.25s ease;
    background: transparent;
}
.logout-link:hover {
    background: var(--c-brass);
    color: var(--c-night);
    box-shadow: 0 0 16px rgba(201, 163, 106, 0.4);
}

.app-main {
    flex: 1;
    width: 100%;
    margin: 0 auto;
    padding: 1.4rem 2rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ============ ログインカード ============ */
.login-card {
    margin: 5rem auto;
    max-width: 460px;
    background: linear-gradient(180deg, rgba(18, 46, 68, 0.9), rgba(8, 21, 31, 0.95));
    border: var(--rule-gold);
    padding: 3rem 2.5rem 2.5rem;
    text-align: center;
    box-shadow: var(--shadow), inset 0 0 0 1px rgba(201, 163, 106, 0.2), inset 0 0 0 6px var(--c-night), inset 0 0 0 7px rgba(201, 163, 106, 0.4);
    position: relative;
}
.login-card::before {
    content: '';
    position: absolute;
    top: 18px; left: 18px; right: 18px;
    height: 1px;
    background: var(--c-brass);
    opacity: 0.5;
}
.login-card::after {
    content: '⚓';
    position: absolute;
    top: -18px; left: 50%;
    transform: translateX(-50%);
    background: var(--c-night);
    color: var(--c-brass-bright);
    padding: 0 1rem;
    font-size: 1.4rem;
}
.login-card h1 {
    font-family: var(--font-japanese);
    color: var(--c-ivory);
    font-size: 1.7rem;
    letter-spacing: 0.25em;
    margin: 0.6rem 0 0.4rem;
}
.login-card p {
    color: var(--c-text-dim);
    font-size: 0.85rem;
    font-style: italic;
    font-family: 'Cormorant Garamond', var(--font-japanese);
    letter-spacing: 0.05em;
    margin-bottom: 2rem;
}
.discord-btn {
    display: inline-block;
    margin-top: 0.5rem;
    background: transparent;
    color: var(--c-brass-bright);
    padding: 0.85rem 2.4rem;
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    text-decoration: none;
    border: 1px solid var(--c-brass);
    box-shadow: inset 0 0 0 4px var(--c-night), inset 0 0 0 5px var(--c-brass);
    transition: all 0.3s ease;
    position: relative;
}
.discord-btn:hover {
    background: var(--c-brass);
    color: var(--c-night);
    box-shadow: inset 0 0 0 4px var(--c-brass), inset 0 0 0 5px var(--c-night), 0 0 24px rgba(201, 163, 106, 0.5);
}

/* ============ パネル共通 ============ */
.tabs-section, .chat-section {
    background: linear-gradient(180deg, rgba(18, 46, 68, 0.55), rgba(8, 21, 31, 0.6));
    border: 1px solid rgba(201, 163, 106, 0.35);
    padding: 1.2rem 1.4rem;
    box-shadow: var(--shadow), inset 0 0 0 1px rgba(244, 236, 216, 0.04);
    position: relative;
}
/* deco corners */
.tabs-section::before, .tabs-section::after,
.chat-section::before, .chat-section::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border: 1px solid var(--c-brass);
}
.tabs-section::before, .chat-section::before {
    top: -1px; left: -1px;
    border-right: none; border-bottom: none;
}
.tabs-section::after, .chat-section::after {
    bottom: -1px; right: -1px;
    border-left: none; border-top: none;
}

/* ============ タブバー ============ */
.tabs-bar {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(201, 163, 106, 0.3);
    padding-bottom: 0;
}

.tab {
    background: transparent;
    color: var(--c-text-dim);
    border: none;
    padding: 0.65rem 1.2rem 0.85rem;
    cursor: pointer;
    font-family: var(--font-japanese);
    font-size: 0.92rem;
    letter-spacing: 0.1em;
    position: relative;
    transition: color 0.2s ease;
    border-right: 1px solid rgba(201, 163, 106, 0.18);
}
.tab:first-child { border-left: 1px solid rgba(201, 163, 106, 0.18); }
.tab:hover { color: var(--c-ivory); }
.tab.active {
    color: var(--c-brass-bright);
    background: linear-gradient(180deg, rgba(201, 163, 106, 0.12), transparent);
}
.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 12%; right: 12%;
    height: 2px;
    background: var(--c-brass-bright);
    box-shadow: 0 0 12px rgba(230, 196, 133, 0.6);
}
.tab.active::before {
    content: '';
    position: absolute;
    top: 4px; left: 50%;
    transform: translateX(-50%);
    width: 6px; height: 6px;
    border: 1px solid var(--c-brass);
    transform: translateX(-50%) rotate(45deg);
}

.own-badge {
    margin-left: 0.5rem;
    color: var(--c-coral);
    border: 1px solid var(--c-coral);
    padding: 0 6px;
    font-size: 0.62rem;
    font-family: var(--font-display);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.tab-counts {
    margin-left: 0.6rem;
    color: var(--c-text-faint);
    font-size: 0.7rem;
    font-family: var(--font-display);
    letter-spacing: 0.1em;
}

/* ============ フィルタ ============ */
.filter-bar {
    display: flex;
    gap: 0;
    align-items: center;
    margin-bottom: 0;
    border: 1px solid rgba(201, 163, 106, 0.3);
    width: fit-content;
}
.search-input {
    background: transparent;
    border: none;
    border-left: 1px solid rgba(201, 163, 106, 0.3);
    color: var(--c-ivory);
    padding: 0.35rem 0.7rem;
    font-family: var(--font-japanese);
    font-size: 0.78rem;
    width: 8rem;
    outline: none;
}
.search-input::placeholder { color: var(--c-text-dim); opacity: 0.6; }
.search-input:focus { background: rgba(201, 163, 106, 0.06); }
.search-clear {
    background: transparent;
    border: none;
    color: var(--c-text-dim);
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    font-size: 0.7rem;
    line-height: 1;
}
.search-clear:hover { color: var(--c-ivory); }
.filter-toolbar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}
.collapse-toggle-row {
    display: flex;
    gap: 0;
    margin-bottom: 0;
}
.collapse-toggle-btn {
    background: transparent;
    border: 1px solid rgba(201, 163, 106, 0.2);
    border-right: none;
    color: var(--c-text-dim);
    cursor: pointer;
    font-family: var(--font-japanese);
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
    transition: all 0.2s;
}
.collapse-toggle-btn:last-child { border-right: 1px solid rgba(201, 163, 106, 0.2); }
.collapse-toggle-btn:hover { color: var(--c-ivory); background: rgba(201, 163, 106, 0.06); }
.filter-btn {
    background: transparent;
    color: var(--c-text-dim);
    border: none;
    padding: 0.35rem 1rem;
    cursor: pointer;
    font-family: var(--font-japanese);
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    border-right: 1px solid rgba(201, 163, 106, 0.3);
    transition: all 0.2s ease;
}
.filter-btn:last-of-type { border-right: none; }
.filter-btn:hover { color: var(--c-ivory); background: rgba(201, 163, 106, 0.08); }
.filter-btn.active {
    background: var(--c-brass);
    color: var(--c-night);
    font-weight: 700;
}

/* ============ テーブル ============ */
.luggage-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--c-text);
    font-family: var(--font-japanese);
}
.luggage-table th {
    text-align: left;
    padding: 0.55rem 0.7rem;
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: var(--c-brass);
    text-transform: uppercase;
    border-bottom: 1px solid var(--c-brass);
    font-weight: 500;
}
.luggage-table td {
    padding: 0.4rem 0.55rem;
    border-bottom: 1px solid rgba(201, 163, 106, 0.12);
    font-size: 0.92rem;
}
.luggage-table tbody tr:not(.cat-header):hover {
    background: rgba(201, 163, 106, 0.04);
}
.luggage-table .notes-col-header,
.luggage-table td.notes-cell {
    max-width: 22rem;
}
.luggage-table td.notes-cell input[type=text] {
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}
.luggage-table .check-col { width: 5.6rem; text-align: center; }
.luggage-table .actions-col { width: 2.6rem; text-align: center; }

.luggage-table input[type=text] {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    border-bottom: 1px dotted rgba(201, 163, 106, 0.2);
    color: var(--c-ivory);
    padding: 0.35rem 0.5rem;
    font-family: inherit;
    font-size: 0.92rem;
}
.luggage-table input[type=text]:focus {
    outline: none;
    background: rgba(244, 236, 216, 0.05);
    border-color: var(--c-brass);
    border-bottom-style: solid;
}
.luggage-table input[type=text]:disabled {
    color: var(--c-text-faint);
    border-bottom-color: transparent;
}

/* notes inline (mobile) hidden by default */
.notes-inline { display: none; }

.luggage-table input[type=checkbox] {
    -webkit-appearance: none;
    appearance: none;
    width: 1.15rem;
    height: 1.15rem;
    border: 1.5px solid var(--c-brass-dim);
    background: rgba(8, 21, 31, 0.5);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.luggage-table input[type=checkbox]:checked {
    background: var(--c-brass);
    border-color: var(--c-brass-bright);
    box-shadow: 0 0 8px rgba(201, 163, 106, 0.3);
}
.luggage-table input[type=checkbox]:checked::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-night);
    font-size: 0.75rem;
    font-weight: 700;
}
.luggage-table input[type=checkbox]:hover:not(:disabled) {
    border-color: var(--c-brass-bright);
    background: rgba(201, 163, 106, 0.1);
}
.luggage-table input[type=checkbox]:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Completed item row subtle fade */
tr.item-packed td { opacity: 0.55; }
tr.item-packed:hover td { opacity: 0.8; }

.row-del {
    background: transparent;
    color: var(--c-coral);
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.row-del:hover { opacity: 1; text-shadow: 0 0 8px rgba(211, 94, 74, 0.6); }

.add-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.75rem;
}
.add-btn {
    background: transparent;
    color: var(--c-brass-bright);
    border: 1px solid var(--c-brass);
    padding: 0.5rem 1.4rem;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    transition: all 0.25s ease;
}
.add-btn:hover {
    background: var(--c-brass);
    color: var(--c-night);
    box-shadow: 0 0 16px rgba(201, 163, 106, 0.35);
}
.add-cat-btn {
    border-style: dashed;
}
.cancel-btn {
    border-color: var(--c-text-faint);
    color: var(--c-text-faint);
}
.cancel-btn:hover {
    background: rgba(244, 236, 216, 0.1);
    color: var(--c-ivory);
    box-shadow: none;
}
.add-category-row {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}
.add-category-input {
    background: transparent;
    border: 1px solid var(--c-brass);
    border-bottom: 1px solid var(--c-brass-bright);
    color: var(--c-ivory);
    padding: 0.4rem 0.7rem;
    font-family: var(--font-japanese);
    font-size: 0.85rem;
    min-width: 10rem;
}
.add-category-input:focus {
    outline: none;
    border-color: var(--c-brass-bright);
    background: rgba(244, 236, 216, 0.05);
}
.add-category-input::placeholder {
    color: var(--c-text-faint);
    font-style: italic;
}

.empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--c-text-faint);
    font-style: italic;
    font-family: 'Cormorant Garamond', var(--font-japanese);
    font-size: 0.95rem;
    letter-spacing: 0.03em;
}
.empty-state p { margin: 0; }

.archive-btn {
    background: transparent;
    border: 1px solid rgba(201, 163, 106, 0.3);
    color: var(--c-text-dim);
    cursor: pointer;
    font-family: var(--font-japanese);
    font-size: 0.72rem;
    padding: 0.35rem 0.85rem;
    letter-spacing: 0.08em;
    transition: all 0.2s;
    margin-left: auto;
}
.archive-btn:hover {
    color: var(--c-brass-bright);
    background: rgba(201, 163, 106, 0.08);
    border-color: var(--c-brass);
}
.filter-toolbar { justify-content: space-between; }

/* 削除確認ダイアログ */
.confirm-card {
    max-width: 460px;
}
.confirm-msg {
    color: var(--c-ivory);
    font-family: var(--font-japanese);
    font-size: 1.02rem;
    line-height: 1.5;
    margin: 1.1rem 0 0.5rem;
}
.confirm-msg strong {
    color: var(--c-brass-bright);
    font-weight: 700;
}
.confirm-actions {
    display: flex;
    gap: 0.7rem;
    justify-content: flex-end;
    margin-top: 1.4rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(201, 163, 106, 0.2);
}
.add-btn.danger-btn {
    border-color: var(--c-coral);
    background: rgba(211, 94, 74, 0.18);
    color: var(--c-coral);
    font-weight: 600;
}
.add-btn.danger-btn:hover {
    background: var(--c-coral);
    color: var(--c-ivory);
    box-shadow: 0 0 20px rgba(211, 94, 74, 0.5);
    border-color: var(--c-coral);
}

/* アーカイブ一覧 */
.archive-card {
    max-width: 640px;
}
.archive-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 0.3rem;
}
.archive-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 0.8rem;
    background: rgba(8, 21, 31, 0.4);
    border: 1px solid rgba(201, 163, 106, 0.18);
}
.archive-info {
    flex: 1;
    min-width: 0;
}
.archive-name {
    color: var(--c-ivory);
    font-family: var(--font-japanese);
    font-size: 0.92rem;
    font-weight: 500;
}
.archive-meta {
    color: var(--c-text-faint);
    font-size: 0.72rem;
    margin-top: 2px;
    font-family: 'Cormorant Garamond', var(--font-japanese);
}
.archive-date {
    opacity: 0.8;
}
.archive-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}
.archive-actions .add-btn {
    padding: 0.3rem 0.8rem;
    font-size: 0.68rem;
}
.readonly-note {
    margin-top: 0.9rem;
    color: var(--c-text-faint);
    font-size: 0.8rem;
    font-style: italic;
    font-family: 'Cormorant Garamond', var(--font-japanese);
}

/* ============ カテゴリ ============ */
.cat-header {
    cursor: pointer;
    user-select: none;
    background: linear-gradient(90deg, rgba(201, 163, 106, 0.1), rgba(201, 163, 106, 0.03), transparent);
    border-top: 1px solid rgba(201, 163, 106, 0.25);
    transition: background 0.2s ease;
}
.cat-header:hover { background: linear-gradient(90deg, rgba(201, 163, 106, 0.2), rgba(201, 163, 106, 0.06), transparent); }
.cat-header td {
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid rgba(201, 163, 106, 0.3);
    color: var(--c-brass-bright);
    font-weight: 500;
    letter-spacing: 0.05em;
}

/* カテゴリヘッダーの進捗ラインインジケーター */
.cat-progress-td {
    position: relative;
}
.cat-progress-td::before,
.cat-progress-td::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    pointer-events: none;
    transition: width 0.4s ease;
}
.cat-progress-td::before {
    width: var(--prep-pct, 0%);
    background: linear-gradient(to right,
        var(--c-brass) 0%,
        var(--c-brass) calc(100% - 6px),
        rgba(201, 163, 106, 0) 100%);
    opacity: 0.6;
}
.cat-progress-td::after {
    width: var(--pack-pct, 0%);
    background: linear-gradient(to right,
        var(--c-brass-bright) 0%,
        var(--c-brass-bright) calc(100% - 7px),
        rgba(230, 196, 133, 0) 100%);
    box-shadow: 0 0 12px rgba(230, 196, 133, 0.5);
}
.cat-toggle {
    display: inline-block;
    width: 1.2rem;
    color: var(--c-brass);
    font-size: 0.7rem;
}
.cat-name {
    color: var(--c-ivory);
    font-family: var(--font-japanese);
    font-weight: 700;
    letter-spacing: 0.08em;
}
.cat-count {
    margin-left: 0.9rem;
    color: var(--c-text-faint);
    font-size: 0.7rem;
    font-family: var(--font-display);
    letter-spacing: 0.12em;
}
.cat-edit-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--c-brass-bright);
    color: var(--c-ivory);
    font-family: var(--font-japanese);
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: 0.08em;
    padding: 0.1rem 0.3rem;
    min-width: 6rem;
}
.cat-edit-input:focus {
    outline: none;
    background: rgba(244, 236, 216, 0.06);
}

/* ============ 旅前提 ============ */
.trip-info-panel { padding: 0.5rem 0; }
.trip-info-hint {
    color: var(--c-text-dim);
    font-style: italic;
    font-family: 'Cormorant Garamond', var(--font-japanese);
    font-size: 0.95rem;
    margin: 0 0 0.8rem 0;
    letter-spacing: 0.02em;
}
.trip-info-editor {
    width: 100%;
    flex: 1;
    min-height: 160px;
    background: rgba(8, 21, 31, 0.6);
    border: 1px solid rgba(201, 163, 106, 0.35);
    padding: 0.9rem 1.1rem;
    color: var(--c-ivory);
    font-family: var(--font-japanese);
    font-size: 0.92rem;
    line-height: 1.65;
    resize: none;
    margin: 0.5rem 0;
}
.trip-info-editor:focus {
    outline: none;
    border-color: var(--c-brass);
    box-shadow: inset 0 0 0 1px rgba(201, 163, 106, 0.3);
}
.save-btn {
    background: transparent;
    color: var(--c-brass-bright);
    border: 1px solid var(--c-brass);
    padding: 0.45rem 1.4rem;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    transition: all 0.25s ease;
}
.save-btn:hover { background: var(--c-brass); color: var(--c-night); }
.saved-note {
    margin-left: 0.8rem;
    color: var(--c-seafoam);
    font-size: 0.78rem;
    font-style: italic;
    font-family: 'Cormorant Garamond', var(--font-japanese);
}

/* ============ チャット ============ */
.chat-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.9rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(201, 163, 106, 0.3);
}
.chat-section h2 {
    font-family: var(--font-display);
    color: var(--c-brass-bright);
    font-size: 0.85rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin: 0;
}
.chat-section h2::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 1px;
    background: var(--c-brass);
    vertical-align: middle;
    margin-right: 0.6rem;
}
.chat-header-tools {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.model-select {
    background: rgba(8, 21, 31, 0.7);
    color: var(--c-brass-bright);
    border: 1px solid var(--c-brass);
    padding: 0.3rem 0.7rem;
    font-family: var(--font-japanese);
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    cursor: pointer;
}
.model-select:focus { outline: none; box-shadow: 0 0 0 1px var(--c-brass-bright); }
.model-select option { background: var(--c-deep); color: var(--c-ivory); }

.reset-btn {
    background: transparent;
    color: var(--c-brass);
    border: 1px solid var(--c-brass);
    padding: 0.3rem 0.85rem;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}
.reset-btn:hover { background: var(--c-brass); color: var(--c-night); }

.chat-log {
    flex: 1;
    background: rgba(8, 21, 31, 0.55);
    border: 1px solid rgba(201, 163, 106, 0.2);
    padding: 1rem;
    height: auto;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin-bottom: 0.8rem;
}

.bubble {
    max-width: 82%;
    padding: 0.7rem 1rem;
    font-family: var(--font-japanese);
    font-size: 0.92rem;
    line-height: 1.65;
    position: relative;
    border: 1px solid transparent;
}
.bubble.user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(201, 163, 106, 0.18), rgba(201, 163, 106, 0.05));
    color: var(--c-ivory);
    border-color: rgba(201, 163, 106, 0.45);
    border-right: 2px solid var(--c-brass);
}
.bubble.assistant {
    align-self: flex-start;
    background: linear-gradient(135deg, rgba(244, 236, 216, 0.95), rgba(212, 203, 182, 0.92));
    color: var(--c-night);
    border-color: rgba(201, 163, 106, 0.6);
    border-left: 2px solid var(--c-brass);
}
.bubble-author {
    font-family: var(--font-display);
    font-size: 0.62rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    opacity: 0.7;
    margin-bottom: 0.35rem;
}
.bubble.user .bubble-author { color: var(--c-brass); }
.bubble.assistant .bubble-author { color: var(--c-brass-dim); }
.bubble-text {
    white-space: normal;
    line-height: 1.6;
    word-break: break-word;
}
.bubble-text ul {
    margin: 0.3rem 0;
    padding-left: 1.2rem;
}
.bubble-text li {
    margin-bottom: 0.15rem;
}
.bubble-text hr {
    border: none;
    border-top: 1px solid rgba(201, 163, 106, 0.3);
    margin: 0.5rem 0;
}
.bubble-text code {
    background: rgba(201, 163, 106, 0.12);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.85em;
    font-family: 'Courier New', monospace;
}
.bubble-text .md-h1 {
    font-size: 1.15em;
    color: var(--c-brass-bright);
    display: block;
    margin-top: 0.3rem;
}
.bubble-text .md-h2 {
    font-size: 1.05em;
    color: var(--c-brass-bright);
    display: block;
    margin-top: 0.2rem;
}
.bubble-text .md-h3 {
    font-size: 0.95em;
    color: var(--c-brass);
    display: block;
}

.trace-details {
    align-self: stretch;
    font-size: 0.78rem;
    color: var(--c-text-dim);
    font-family: var(--font-display);
}
.trace-details summary {
    cursor: pointer;
    padding: 0.3rem 0;
    color: var(--c-brass);
    user-select: none;
    letter-spacing: 0.1em;
    font-size: 0.7rem;
    text-transform: uppercase;
}
.trace-details summary:hover { color: var(--c-brass-bright); }
.trace {
    font-family: 'Consolas', monospace;
    font-size: 0.7rem;
    color: var(--c-text-faint);
    background: rgba(0, 0, 0, 0.4);
    padding: 0.5rem 0.7rem;
    border-left: 2px solid var(--c-brass-dim);
    overflow-x: auto;
    margin-top: 0.3rem;
}
.trace > div { padding: 0.15rem 0; word-break: break-all; }

.chat-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}
.chat-input {
    flex: 1;
    background: rgba(8, 21, 31, 0.75);
    border: 1px solid var(--c-brass);
    color: var(--c-ivory);
    padding: 0.7rem 1rem;
    font-family: var(--font-japanese);
    font-size: 0.92rem;
    resize: vertical;
    min-height: 2.6rem;
    max-height: 12rem;
    line-height: 1.5;
}
.chat-input:focus {
    outline: none;
    box-shadow: 0 0 0 1px var(--c-brass-bright), 0 0 16px rgba(201, 163, 106, 0.25);
    background: rgba(18, 46, 68, 0.7);
}
.mic-btn, .send-btn {
    background: transparent;
    color: var(--c-brass-bright);
    border: 1px solid var(--c-brass);
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    transition: all 0.25s ease;
}
.mic-btn { padding: 0.55rem 0.75rem; font-size: 1rem; }
.mic-btn:hover, .send-btn:hover {
    background: var(--c-brass);
    color: var(--c-night);
    box-shadow: 0 0 12px rgba(201, 163, 106, 0.35);
}
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.mic-btn.listening {
    background: var(--c-coral);
    color: var(--c-ivory);
    border-color: var(--c-coral);
    animation: pulse 1.2s infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(211, 94, 74, 0.5); }
    50% { box-shadow: 0 0 0 8px rgba(211, 94, 74, 0); }
}

/* ============ スプリッター ============ */
.split-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    --split-top: 0.5;
    --split-bottom: 0.5;
}
.split-top {
    flex-grow: var(--split-top);
    flex-shrink: 1;
    flex-basis: 0;
    min-height: 0;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
}
.split-top > .tabs-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.tabs-bar, .filter-bar, .filter-toolbar, .collapse-toggle-row { flex-shrink: 0; }
.tabs-section .table-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
.trip-info-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.trip-info-panel .save-btn-row { flex-shrink: 0; }
.split-bottom {
    flex-grow: var(--split-bottom);
    flex-shrink: 1;
    flex-basis: 0;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
}
.splitter-handle {
    height: 18px;
    margin: 8px 0;
    cursor: row-resize;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.splitter-handle::before {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 50%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--c-brass), transparent);
    opacity: 0.5;
    transform: translateY(-50%);
}
.splitter-handle::after {
    content: '◆';
    position: relative;
    color: var(--c-brass);
    background: var(--c-night);
    padding: 0 1rem;
    font-size: 0.7rem;
    z-index: 1;
}
.splitter-handle:hover::before { opacity: 1; }
.splitter-handle:hover::after { color: var(--c-brass-bright); text-shadow: 0 0 10px rgba(230, 196, 133, 0.5); }

/* ============ モーダル ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 500;
    padding: 2rem;
    backdrop-filter: blur(4px);
}
.modal-card {
    background: linear-gradient(180deg, var(--c-deep2), var(--c-night));
    border: var(--rule-gold);
    padding: 1.8rem;
    max-width: 900px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--shadow), inset 0 0 0 6px var(--c-night), inset 0 0 0 7px rgba(201, 163, 106, 0.4);
    position: relative;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(201, 163, 106, 0.4);
    padding-bottom: 0.6rem;
}
.modal-header h3 {
    font-family: var(--font-display);
    color: var(--c-brass-bright);
    margin: 0;
    font-size: 1rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}
.modal-hint {
    color: var(--c-text-dim);
    font-style: italic;
    font-family: 'Cormorant Garamond', var(--font-japanese);
    font-size: 0.95rem;
    margin: 0;
}
.modal-actions {
    margin: 0.6rem 0 0.4rem;
}
.modal-actions .add-btn {
    font-size: 0.75rem;
    padding: 0.4rem 1.2rem;
}
.export-textarea {
    flex: 1;
    min-height: 400px;
    background: rgba(0, 0, 0, 0.5);
    color: var(--c-brass-bright);
    border: 1px solid rgba(201, 163, 106, 0.35);
    padding: 1rem;
    font-family: 'Consolas', monospace;
    font-size: 0.78rem;
    line-height: 1.6;
    resize: vertical;
}

/* ============ モバイル ============ */
@media (max-width: 640px) {
    .app-header { padding: 0.45rem 0.6rem; }
    .brand-mark { font-size: 1.1rem; }
    .brand-overline { font-size: 0.5rem; letter-spacing: 0.3em; }
    .brand-text { font-size: 0.9rem; letter-spacing: 0.1em; }
    .user-area { font-size: 0.72rem; gap: 0.4rem; }
    .logout-link { padding: 0.2rem 0.5rem; font-size: 0.55rem; letter-spacing: 0.15em; }

    .app-main { padding: 0.35rem 0.35rem; }
    .tabs-section, .chat-section { padding: 0.5rem 0.55rem; }

    .tabs-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.3rem;
        margin-bottom: 0.5rem;
    }
    .tab {
        padding: 0.4rem 0.7rem 0.5rem;
        font-size: 0.8rem;
        flex-shrink: 0;
        letter-spacing: 0.05em;
    }
    .own-badge { font-size: 0.5rem; padding: 0 3px; margin-left: 0.3rem; }
    .tab-counts { display: none; }

    .filter-toolbar { gap: 0.3rem; margin-bottom: 0.4rem; }
    .filter-btn { padding: 0.2rem 0.55rem; font-size: 0.65rem; letter-spacing: 0.05em; }
    .search-input { width: 4.5rem; font-size: 0.65rem; padding: 0.2rem 0.4rem; }
    .collapse-toggle-btn { font-size: 0.55rem; padding: 0.15rem 0.35rem; }

    .handle-col { width: 1rem; min-width: 1rem; max-width: 1rem; }
    .drag-handle, .cat-handle { font-size: 0.65rem; }
    .luggage-table .check-col { width: 1.9rem; font-size: 0.55rem; letter-spacing: 0; }
    .luggage-table .actions-col { width: 1.4rem; }
    .luggage-table th {
        padding: 0.25rem 0.2rem;
        font-size: 0.55rem;
        letter-spacing: 0.05em;
    }
    .luggage-table td { padding: 0.2rem 0.2rem; font-size: 0.78rem; }
    .luggage-table th.check-col { font-size: 0.5rem; padding: 0.25rem 0.1rem; word-break: keep-all; }
    .luggage-table input[type=text] { padding: 0.15rem 0.25rem; font-size: 0.8rem; }
    .luggage-table input[type=checkbox] { width: 0.95rem; height: 0.95rem; }

    .luggage-table th.notes-col-header,
    .luggage-table td.notes-cell { display: none; }
    .notes-inline {
        display: block;
        margin-top: 1px;
        font-size: 0.65rem !important;
        color: var(--c-text-faint);
        font-style: italic;
        padding: 0 0.25rem !important;
    }

    .cat-header td { padding: 0.35rem 0.3rem; }
    .cat-progress-td::before,
    .cat-progress-td::after { height: 1.5px; }
    .cat-name { font-size: 0.85rem; letter-spacing: 0.04em; }
    .cat-count { display: block; margin-left: 0; font-size: 0.58rem; margin-top: 1px; }
    .cat-toggle { width: 0.9rem; font-size: 0.6rem; }

    .chat-header { flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.5rem; padding-bottom: 0.4rem; }
    .chat-section h2 { font-size: 0.7rem; letter-spacing: 0.18em; }
    .chat-section h2::before { width: 12px; margin-right: 0.3rem; }
    .chat-header-tools { gap: 0.25rem; flex-wrap: wrap; }
    .model-select { padding: 0.15rem 0.35rem; font-size: 0.65rem; }
    .reset-btn { padding: 0.15rem 0.4rem; font-size: 0.55rem; }

    .chat-log { padding: 0.45rem; }
    .bubble { max-width: 94%; font-size: 0.8rem; padding: 0.45rem 0.6rem; }

    .chat-input-row { gap: 0.25rem; }
    .chat-input { padding: 0.4rem 0.55rem; font-size: 0.85rem; }
    .mic-btn, .send-btn { padding: 0.35rem 0.55rem; font-size: 0.65rem; }
    .mic-btn { font-size: 0.9rem; }

    .add-btn { font-size: 0.65rem; padding: 0.3rem 0.75rem; letter-spacing: 0.12em; }
    .add-actions { gap: 0.35rem; margin-top: 0.5rem; }

    .splitter-handle { height: 14px; margin: 4px 0; }
    .splitter-handle::after { font-size: 0.6rem; padding: 0 0.7rem; }

    .modal-card { padding: 0.8rem; max-height: 90vh; }
    .modal-header h3 { font-size: 0.85rem; letter-spacing: 0.15em; }
    .modal-hint { font-size: 0.8rem; }

    .confirm-card { max-width: 100%; }
    .confirm-msg { font-size: 0.9rem; margin: 0.8rem 0 0.3rem; }
    .confirm-actions { flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; padding-top: 0.7rem; }
    .confirm-actions .add-btn { flex: 1; min-width: 0; padding: 0.5rem 0.6rem; font-size: 0.72rem; }

    .archive-card { max-width: 100%; }
    .archive-list { max-height: 60vh; }
    .archive-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.5rem 0.6rem;
    }
    .archive-actions { justify-content: flex-end; }
    .archive-actions .add-btn { padding: 0.35rem 0.7rem; font-size: 0.65rem; }
    .archive-name { font-size: 0.85rem; }
    .archive-meta { font-size: 0.68rem; }

    .archive-btn {
        font-size: 0.62rem;
        padding: 0.2rem 0.5rem;
        letter-spacing: 0.04em;
    }

    .login-card { margin: 2rem auto; padding: 1.8rem 1.3rem; }
    .login-card h1 { font-size: 1.3rem; }

    /* パネルのデコ装飾を外す（スペース節約） */
    .tabs-section::before, .tabs-section::after,
    .chat-section::before, .chat-section::after { display: none; }
}

/* ============ エラーUI ============ */
#blazor-error-ui {
    background: var(--c-coral);
    color: var(--c-ivory);
    bottom: 0;
    left: 0;
    padding: 0.7rem 1.4rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-family: var(--font-japanese);
    border-top: 2px solid var(--c-brass);
    display: none;
}
#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* =====================================================
   Drag & Drop — Brass Instrument Handles
   ===================================================== */

/* Dedicated narrow handle column */
.handle-col {
    width: 1.6rem;
    min-width: 1.6rem;
    max-width: 1.6rem;
    text-align: center;
    padding: 0 !important;
    border-bottom-color: transparent !important;
}
.luggage-table th.handle-col {
    border-bottom: 1px solid var(--c-brass);
}

/* Shared handle base style */
.drag-handle,
.cat-handle {
    cursor: grab;
    color: var(--c-brass-dim);
    opacity: 0.35;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 0.85rem;
    line-height: 1;
    transition: opacity 0.2s, color 0.2s, text-shadow 0.2s;
}
.luggage-table tr:hover .drag-handle,
.cat-header:hover .cat-handle {
    opacity: 0.7;
}
.drag-handle:hover,
.cat-handle:hover {
    opacity: 1;
    color: var(--c-brass-bright);
    text-shadow: 0 0 6px rgba(230, 196, 133, 0.35);
}
.drag-handle:active,
.cat-handle:active {
    cursor: grabbing;
    color: var(--c-brass-bright);
    opacity: 1;
}

/* Category handle slightly larger */
.cat-handle {
    font-size: 0.8rem;
    opacity: 0.55;
}
.cat-handle-cell {
    border-bottom: 1px solid rgba(201, 163, 106, 0.3) !important;
}

/* ---- SortableJS drag states ---- */

/* Ghost = placeholder left behind at drop position */
.dnd-ghost {
    opacity: 0.4;
    background: rgba(201, 163, 106, 0.1) !important;
    border: 1px dashed rgba(201, 163, 106, 0.5) !important;
    border-radius: 2px;
}
.dnd-ghost td {
    opacity: 0.3;
}

/* Chosen = item being picked up */
.dnd-chosen {
    background: rgba(23, 59, 86, 0.9) !important;
    box-shadow: inset 0 0 0 1px rgba(201, 163, 106, 0.25),
                0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Drag = item in-flight */
.dnd-drag {
    opacity: 0.92;
    background: var(--c-deep2) !important;
    border: 1px solid var(--c-brass) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(201, 163, 106, 0.2);
    border-radius: 2px;
}

/* Category header drag states */
.dnd-ghost-cat {
    opacity: 0.4;
    background: rgba(201, 163, 106, 0.12) !important;
    border: 1px dashed rgba(230, 196, 133, 0.5) !important;
}
.dnd-ghost-cat td {
    opacity: 0.3;
}
.dnd-chosen-cat {
    background: rgba(18, 46, 68, 0.95) !important;
    box-shadow: inset 0 0 0 1px rgba(201, 163, 106, 0.35),
                0 2px 12px rgba(0, 0, 0, 0.35);
}
