:root {
    --bg: #e8edf5;
    --bg-accent: #d4deec;
    --card: #ffffff;
    --ink: #0c1524;
    --muted: #5a6b82;
    --line: #cfd8e6;
    --accent: #163560;
    --accent-2: #2a5699;
    --danger: #b42318;
    --sidebar: #071221;
    --sidebar-2: #10243f;
    --shadow: 0 14px 36px rgba(8, 20, 40, 0.07);
    --radius: 14px;
    --font: "IBM Plex Sans", "Segoe UI", sans-serif;
    --display: "IBM Plex Sans", "Segoe UI", sans-serif;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 17px;
    color: var(--ink);
    background:
        radial-gradient(ellipse 80% 50% at 0% 0%, rgba(42, 86, 153, 0.12), transparent 55%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(10, 22, 40, 0.06), transparent 50%),
        var(--bg);
    line-height: 1.5;
    letter-spacing: 0.01em;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-2); }

.shell { display: flex; min-height: 100vh; position: relative; }

.nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 22, 40, 0.5);
    backdrop-filter: blur(2px);
    z-index: 30;
    border: 0;
    cursor: pointer;
}

.sidebar {
    width: 260px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    color: #e6edf7;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 40;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 650;
    font-size: 1.05rem;
    min-width: 0;
    letter-spacing: 0.01em;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, var(--accent-2), var(--accent));
    box-shadow: 0 8px 18px rgba(26, 58, 107, 0.35);
    color: #fff;
}
.brand-icon { width: 18px; height: 18px; }

.sidebar nav a,
.sidebar nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #b7c5d8;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.98rem;
    transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.85;
}
.sidebar nav a:hover,
.sidebar nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    transform: translateX(2px);
}
.sidebar nav a.active,
.sidebar nav .nav-link.active {
    background: rgba(42, 86, 153, 0.45);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}
.sidebar nav a.active .nav-icon,
.sidebar nav .nav-link.active .nav-icon { opacity: 1; }

.brand-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--display);
    font-size: 1.2rem;
    font-weight: 600;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow: auto;
}

.nav-label {
    margin: 16px 4px 6px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7d8fa8;
    font-weight: 600;
}

.logout { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.08); }
.logout button {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: 0;
    color: #b7c5d8;
    cursor: pointer;
    font: inherit;
    text-align: left;
    padding: 10px 12px;
    border-radius: 10px;
}
.logout button:hover { background: rgba(255,255,255,0.06); color: #fff; }
.logout-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.logout-avatar .icon { width: 16px; height: 16px; }
.logout-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.logout-name { font-weight: 600; color: #fff; }
.logout-action {
    font-size: 0.82rem;
    opacity: 0.8;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.nav-close, .nav-toggle {
    display: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    color: inherit;
}

.nav-close {
    font-size: 1.6rem;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: #fff;
}
.nav-close:hover { background: rgba(255,255,255,0.08); }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-title {
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-user {
    font-size: 0.85rem;
    color: var(--muted);
    max-width: 30vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-toggle {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--line);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
}
.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
}

.content {
    flex: 1;
    padding: clamp(16px, 3vw, 32px);
    width: min(1100px, 100%);
    margin: 0 auto;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.page-head > div { display: flex; gap: 8px; flex-wrap: wrap; }

h1 {
    margin: 0 0 16px;
    font-family: var(--display);
    font-size: clamp(1.7rem, 2.8vw, 2.25rem);
    letter-spacing: -0.015em;
    font-weight: 650;
    line-height: 1.2;
}

h2 {
    font-family: var(--display);
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--card);
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
    background: transparent;
}

.table th, .table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.table th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: #f2f5fa;
    font-weight: 600;
}

.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: #f2f5fa; }

.row-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-actions form { display: inline; }
.row-actions a, .row-actions button {
    font-weight: 600;
    font-size: 1rem;
}
.row-actions button {
    background: none;
    border: 0;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    padding: 0;
}

.btn, button.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    background: linear-gradient(145deg, var(--accent-2), var(--accent));
    color: #fff;
    border: 0;
    border-radius: 10px;
    padding: 0 18px;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    font-size: 1.02rem;
    letter-spacing: 0.01em;
    box-shadow: 0 8px 18px rgba(26, 58, 107, 0.22);
    transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.btn .icon, button.btn .icon { width: 16px; height: 16px; }
.btn-block { width: 100%; }
.btn:hover, button.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(26, 58, 107, 0.28);
    color: #fff;
}
.btn-light {
    background: #e6ecf4;
    color: var(--ink);
    box-shadow: none;
}
.btn-light:hover { color: var(--ink); background: #d7e0ec; }
.btn-danger { background: var(--danger); box-shadow: none; }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 0.92rem; }

.stack { display: flex; flex-direction: column; gap: 14px; max-width: 680px; width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 1rem; font-weight: 500; }
.field input, .field select, .field textarea {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26, 58, 107, 0.15);
}

.flash {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    background: #e7eef8;
    border: 1px solid #b8cae0;
    animation: rise .35s ease;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.flash .icon { flex-shrink: 0; margin-top: 2px; }
.flash-error { background: #fdecec; border-color: #f0c2c2; color: #7a1f1f; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: clamp(16px, 3vw, 22px);
    box-shadow: var(--shadow);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.tile {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 16px;
    text-decoration: none;
    color: var(--ink);
    font-weight: 600;
    box-shadow: var(--shadow);
    transition: transform .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
    display: flex;
    align-items: center;
    gap: 12px;
}
.tile-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: #eaf0f8;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tile-icon .icon { width: 18px; height: 18px; }
.tile:hover {
    transform: translateY(-3px);
    border-color: #a8bcd4;
    color: var(--ink);
    box-shadow: 0 16px 32px rgba(8, 20, 40, 0.1);
}

.guest {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    position: relative;
}
.guest-bg {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 50% at 20% 10%, rgba(42, 86, 153, 0.22), transparent 55%),
        radial-gradient(ellipse 50% 40% at 90% 90%, rgba(10, 22, 40, 0.12), transparent 50%),
        linear-gradient(160deg, #e8eef6, #d5deeb);
    z-index: 0;
}
.guest-card {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    animation: rise .4s ease;
}
.guest-card-wide {
    width: min(640px, 100%);
}
.guest-brand {
    margin: 0;
    font-family: var(--display);
    font-size: 1.45rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}
.guest h1 { margin-top: 0; }

.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
}
.request-fieldset {
    margin: 0;
    padding: 0;
    border: 0;
    display: grid;
    gap: 12px;
}
.request-fieldset legend {
    padding: 0;
    margin: 0 0 4px;
    font-weight: 600;
    font-size: 1.02rem;
}
.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
}
.filter-tabs a {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--card);
    text-decoration: none;
    color: var(--ink);
    font-weight: 500;
    font-size: 0.95rem;
}
.filter-tabs a.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 3px; }

.repeat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin: 8px 0 12px;
    flex-wrap: wrap;
}

.perm-groups fieldset {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    margin: 0 0 12px;
    background: #fbfcfb;
}
.perm-groups legend {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding: 0 6px;
    font-weight: 600;
}
.suggested { background: #fff6d6; border-radius: 8px; padding: 4px 8px; }

.details {
    display: grid;
    grid-template-columns: minmax(100px, 160px) 1fr;
    gap: 8px 14px;
    background: var(--card);
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.details dt { color: var(--muted); font-size: 0.9rem; }
.details dd { margin: 0; font-weight: 600; }

.term-meta { margin-top: 14px; padding: 16px 18px; }
.term-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
}
.term-meta-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 14px 10px 0;
    border-bottom: 1px solid var(--line);
}
.term-meta-item:nth-child(even) {
    padding-left: 14px;
    padding-right: 0;
    border-left: 1px solid var(--line);
}
.term-meta-label {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}
.term-meta-value {
    font-weight: 600;
    font-size: 1.02rem;
    line-height: 1.35;
    word-break: break-word;
}
@media (max-width: 700px) {
    .term-meta-grid { grid-template-columns: 1fr; }
    .term-meta-item,
    .term-meta-item:nth-child(even) {
        padding: 10px 0;
        border-left: 0;
    }
}

.muted { color: var(--muted); font-size: 0.98rem; }

@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
    .topbar, .nav-toggle { display: flex; }
    .nav-close { display: grid; place-items: center; }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(300px, 86vw);
        transform: translateX(-105%);
        transition: transform .22s ease;
        box-shadow: 20px 0 40px rgba(0,0,0,0.2);
    }
    .shell.is-nav-open .sidebar { transform: translateX(0); }
    .shell.is-nav-open .nav-backdrop { display: block; }
    .nav-backdrop[hidden] { display: none !important; }

    .content { padding: 16px; }
    .content > h1:first-child,
    .page-head > h1 { display: none; }
    .page-head { align-items: flex-start; margin-top: 0; }
    .table { min-width: 480px; }
    .stack { max-width: none; }
}

@media (max-width: 640px) {
    .details { grid-template-columns: 1fr; }
    .details dt { margin-top: 6px; }
    .repeat-row { grid-template-columns: 1fr; }
    .grid { grid-template-columns: 1fr 1fr; }
    .btn, button.btn { width: auto; }
    .page-head .btn, .page-head a.btn { flex: 1 1 auto; text-align: center; }
    .topbar-user { display: none; }
}

@media (max-width: 400px) {
    .grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}

.lead { color: var(--muted); margin: -6px 0 18px; font-size: 1.05rem; }
.section-title { margin: 22px 0 12px; font-size: 1.25rem; font-weight: 600; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.stat-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    text-decoration: none;
    color: var(--ink);
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 4px;
    align-items: center;
    transition: transform .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.stat-card:hover {
    transform: translateY(-2px);
    border-color: #a8bcd4;
    color: var(--ink);
    box-shadow: 0 16px 32px rgba(8, 20, 40, 0.1);
}
.stat-icon {
    grid-row: 1 / span 2;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(145deg, #eaf0f8, #dce6f3);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.stat-icon .icon { width: 20px; height: 20px; }
.stat-label { color: var(--muted); font-size: 0.88rem; font-weight: 500; }
.stat-value { font-family: var(--display); font-size: 1.85rem; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }

.dash-panel h2, .phase-card h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.dash-panel h2 .icon { color: var(--accent); opacity: 0.9; }

.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}
.dash-panel .panel-head,
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.event-list, .todo-preview { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.event-row, .todo-preview li {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    background: #f2f5fa;
    text-decoration: none;
    color: inherit;
}
.todo-preview li { grid-template-columns: 1fr; }
.event-date { display: flex; flex-direction: column; font-size: 0.85rem; color: var(--muted); }
.event-date strong { font-size: 1.05rem; color: var(--ink); }
.event-body { display: flex; flex-direction: column; min-width: 0; }
.event-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
    background: #e6ecf4;
    color: var(--ink);
    white-space: nowrap;
}
.badge.is-planned { background: #e7eef8; color: #1a3a6b; }
.badge.is-live { background: #fff1d6; color: #7a4d00; }
.badge.is-done { background: #e4edf7; color: #1a3a6b; }
.badge.is-cancel { background: #fdecec; color: #7a1f1f; }
tr.is-pending-row td { background: #fff8f8; }
.plain-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.plain-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--line, #e6ecf4);
}
.plain-list li:last-child { border-bottom: 0; }
.term-setup-hint { border-left: 3px solid var(--navy, #1a3a6b); }

.badge-list {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.field-badges .badge-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.badge-pick {
    display: inline-flex;
    margin: 0;
    cursor: pointer;
    user-select: none;
}
.badge-pick input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}
.badge-pick .badge {
    opacity: 0.48;
    border: 2px solid transparent;
    transition: opacity 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.badge-pick:hover .badge { opacity: 0.8; }
.badge-pick input:checked + .badge {
    opacity: 1;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
.badge-pick input:focus-visible + .badge {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.progress-track {
    height: 8px;
    background: #dce3ee;
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}
.progress-track.compact { margin: 8px 0 4px; }
.progress-track > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-2), var(--accent));
    border-radius: inherit;
}
.progress-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.progress-card:last-child { border-bottom: 0; }
.progress-card-top { display: flex; justify-content: space-between; gap: 8px; }

.event-cards { display: grid; gap: 12px; }
.event-card {
    display: grid;
    grid-template-columns: 84px 1fr;
    gap: 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
}
.event-card-date {
    background: #0f1b2d;
    color: #fff;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 6px;
    text-align: center;
}
.event-card-date .day { font-size: 1.65rem; font-weight: 650; line-height: 1; }
.event-card-date .month { font-size: 0.8rem; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.04em; }
.event-card-body { min-width: 0; }
.event-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.event-card-top h3 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.event-card-top h3 a { color: inherit; text-decoration: none; }

.term-hero { margin-bottom: 4px; }
.term-when { font-size: 1.12rem; }

.phase-list { display: grid; gap: 12px; }
.step-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.step-list li {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 10px;
    align-items: start;
    padding: 10px;
    border-radius: 8px;
    background: #f2f5fa;
}
.step-list li.is-done { opacity: 0.72; }
.step-list li.is-done strong { text-decoration: line-through; }
.step-body { min-width: 0; }
.step-remove button {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 4px 8px;
}
.step-toggle button, .step-static {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
    font-size: 1rem;
}
.step-toggle button:hover { border-color: var(--accent); }
.step-add-form {
    display: grid;
    grid-template-columns: 1fr minmax(120px, 180px) auto;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}
.step-add-form input[type="text"],
.step-add-form select {
    width: 100%;
    min-height: 40px;
}
.ablauf-empty { max-width: 520px; }
.ablauf-board { margin-top: 8px; scroll-margin-top: 16px; }
@media (max-width: 640px) {
    .step-add-form { grid-template-columns: 1fr; }
}

.schema-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    align-items: end;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}
.schema-options {
    grid-column: 1 / -1;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f2f5fa;
    border: 1px solid var(--line);
}
.schema-select-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 18px;
    align-items: end;
    margin-bottom: 10px;
}
.schema-select-settings .field { min-width: 220px; flex: 1; }
.schema-select-settings .check { padding-bottom: 8px; }
.schema-option-list {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}
.schema-option-row {
    display: grid;
    grid-template-columns: minmax(100px, 0.8fr) minmax(120px, 1fr) minmax(140px, 1fr) auto auto;
    gap: 8px;
    align-items: end;
}
.schema-badge-preview { justify-self: start; align-self: center; }
@media (max-width: 800px) {
    .schema-option-row {
        grid-template-columns: 1fr 1fr;
    }
    .schema-badge-preview,
    .schema-option-row .link-danger {
        grid-column: 1 / -1;
    }
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.note-card h2 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.note-body {
    margin: 0 0 12px;
    white-space: pre-wrap;
    line-height: 1.45;
    color: var(--text);
}
.empty-state {
    text-align: center;
    padding: 28px 18px;
}
.empty-state .btn { margin-top: 8px; }

.message-board { margin: 16px 0; }
.message-hint { margin: 0 0 10px; font-size: 0.95rem; }

.team-board { margin: 16px 0; }
.team-layout {
    display: grid;
    gap: 16px;
}
@media (min-width: 900px) {
    .team-layout {
        grid-template-columns: 1fr 1fr;
        align-items: start;
        gap: 20px;
    }
}
.team-col {
    display: grid;
    gap: 12px;
    min-width: 0;
}
.team-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}
.team-item {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f2f5fa;
    border: 1px solid var(--line);
}
.team-item.is-me {
    background: #e4edf7;
    border-color: #b8cae0;
}
.team-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.team-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.team-duty-form {
    display: flex;
    gap: 6px;
    align-items: center;
}
.team-duty-form select {
    min-width: 120px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    background: #fff;
}
.duty-admin {
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #f2f5fa;
}
.duty-admin h3 {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 600;
}
.duty-admin .muted { margin: 0 0 8px; font-size: 0.92rem; }
.duty-chip-list {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.duty-chip-list li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid var(--line);
    font-weight: 500;
    font-size: 0.95rem;
}
.duty-chip-list form { display: inline; }
.duty-add-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: stretch;
}
.duty-add-form input {
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    background: #fff;
}
.duty-add-form .btn {
    height: 44px;
    min-height: 44px;
    padding: 0 14px;
    white-space: nowrap;
}
.duty-readonly { margin: 0; }
.team-compose {
    margin: 0;
    display: grid;
    gap: 10px;
    max-width: none;
}
.team-compose-row {
    display: grid;
    gap: 10px;
}
@media (min-width: 900px) {
    .team-compose-row {
        grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto;
        align-items: end;
    }
    .team-compose-row .btn { height: 44px; min-height: 44px; }
}
.team-self {
    margin: 0;
    padding: 12px;
    border-radius: 8px;
    background: #e4edf7;
    border: 1px solid #b8cae0;
}
.team-self p { margin: 0 0 8px; }
.team-self-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.team-self .btn { width: auto; }
.team-self.team-compose .btn { width: 100%; }
@media (min-width: 900px) {
    .team-self.team-compose {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: end;
        gap: 10px;
    }
    .team-self.team-compose .field { margin: 0; }
    .team-self.team-compose .btn { width: auto; min-width: 140px; height: 44px; }
}
.team-self.is-leave-pending,
.team-item.is-leave-pending {
    border-color: #e0b84a;
    background: #fff8e8;
}
.team-self.is-leave-pending p { margin: 0 0 8px; }
.team-empty { margin: 0; }
.message-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
    max-height: 420px;
    overflow: auto;
}
.message-item {
    padding: 12px 14px;
    border-radius: 8px;
    background: #f2f5fa;
    border: 1px solid var(--line);
    position: relative;
}
.message-item.is-mine {
    background: #e4edf7;
    border-color: #b8cae0;
}
.message-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
    font-size: 0.9rem;
}
.message-item p { margin: 0; line-height: 1.45; }
.message-delete { margin-top: 6px; }
.link-danger {
    background: none;
    border: 0;
    padding: 0;
    color: var(--danger);
    cursor: pointer;
    font: inherit;
    font-size: 0.85rem;
}
.message-compose {
    margin-top: 12px;
    display: grid;
    gap: 10px;
}
@media (min-width: 900px) {
    .message-compose {
        grid-template-columns: 1fr auto;
        align-items: end;
    }
    .message-compose .btn {
        height: 44px;
        min-height: 44px;
        align-self: end;
        margin-bottom: 2px;
    }
}
.message-preview { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.message-preview a {
    display: grid;
    gap: 2px;
    text-decoration: none;
    color: inherit;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}
.message-preview li:last-child a { border-bottom: 0; }
.preview-line {
    color: var(--muted);
    font-size: 0.92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 700px) {
    .event-card { grid-template-columns: 1fr; }
    .event-card-date { flex-direction: row; gap: 8px; justify-content: flex-start; padding: 10px 12px; }
    .event-row { grid-template-columns: 1fr; }
}

.app-dialog {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0;
    max-width: min(440px, calc(100vw - 32px));
    color: var(--text);
    background: #fff;
    box-shadow: 0 18px 48px rgba(15, 35, 70, 0.22);
}
.app-dialog::backdrop {
    background: rgba(12, 28, 55, 0.45);
}
.app-dialog-body {
    display: grid;
    gap: 12px;
    padding: 20px 22px 18px;
}
.app-dialog-body h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}
.app-dialog-body p { margin: 0; color: var(--muted); line-height: 1.45; }
.app-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 6px;
}

.barcode-row,
.field .barcode-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.barcode-row input { flex: 1; min-width: 0; }
.barcode-row .btn { flex: none; }
.scan-dialog { width: min(440px, calc(100vw - 32px)); }
.scan-video {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 10px;
    background: #0d1526;
}

.purchase-add-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}
.purchase-table tr.is-done td {
    color: var(--muted);
    text-decoration: line-through;
}
.purchase-table tr.is-done td:last-child { text-decoration: none; }
.check-btn {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--accent);
    padding: 4px 8px;
}

.inventory-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f7f9fc;
}
.table tr.is-empty-stock td:first-child {
    box-shadow: inset 3px 0 0 var(--accent);
}
.duty-copy-form { margin-top: 8px; }

.schedule-sheet-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}
.schedule-sheet-head h1 {
    margin: 0 0 4px;
    font-size: 1.6rem;
}
.schedule-kicker {
    margin: 0 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
}
.schedule-meta { text-align: right; font-size: 0.9rem; }
.schedule-table tr.is-past td { color: var(--muted); }
.schedule-table tr.is-cancelled td { opacity: 0.7; }
.print-only { display: none; }

@media print {
    .sidebar,
    .topbar,
    .nav-backdrop,
    .no-print,
    .logout,
    .flash {
        display: none !important;
    }
    .shell,
    .main-wrap,
    .content {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        box-shadow: none !important;
    }
    .print-only { display: inline; }
    .schedule-sheet a { color: inherit; text-decoration: none; }
    .badge { border: 1px solid #ccc; }
    .schedule-table { font-size: 11pt; }
    .schedule-table th,
    .schedule-table td {
        padding: 6px 8px;
        border-bottom: 1px solid #ddd;
    }
}

/* —— Icons & modern chrome —— */
.icon {
    width: 1.15em;
    height: 1.15em;
    display: inline-block;
    vertical-align: -0.15em;
    flex-shrink: 0;
}
.icon-sm { width: 14px; height: 14px; vertical-align: -0.12em; }

.content-enter {
    animation: content-in .45s var(--ease) both;
}
@keyframes content-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.page-title-block { display: grid; gap: 4px; }
.page-kicker {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.page-head h1 { margin: 0; }

.welcome-line {
    display: flex;
    align-items: center;
    gap: 12px;
}
.welcome-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #eaf0f8;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.welcome-avatar .icon { width: 18px; height: 18px; }

.field span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.field input, .field select, .field textarea {
    border-radius: 10px;
}

.guest-brand-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}
.guest-mark { width: 42px; height: 42px; }
.guest-head h1 { margin-bottom: 6px; }
.guest-head .muted { margin: 0 0 18px; }
.guest-foot {
    margin-top: 18px;
    text-align: center;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
}
.guest-foot a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.filter-tabs a {
    border-radius: 10px;
    transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.filter-tabs a:hover {
    border-color: #a8bcd4;
}

.card {
    border-radius: var(--radius);
    transition: box-shadow .2s var(--ease);
}

.event-row {
    transition: background .15s var(--ease), transform .15s var(--ease);
}
.event-row:hover {
    transform: translateX(2px);
}

.quick-links .tile span:last-child { line-height: 1.25; }

.invite-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 12px;
}
.invite-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    background: #f7f9fc;
    display: grid;
    gap: 10px;
}
.invite-card.is-highlight {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(26, 58, 107, 0.15);
}
.invite-card.is-invalid { opacity: 0.72; }
.invite-card-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}
.invite-qr {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--line);
}
.invite-card .field { margin: 0; }
.invite-card input[readonly] {
    font-size: 0.85rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
