:root {
    --bg: #f5f2ec;
    --surface: #fffdf8;
    --ink: #1d1b18;
    --muted: #736c61;
    --line: #ded6c9;
    --accent: #1f4b3f;
    --accent2: #efe6d6;
    --danger: #9e2a2b;
    --ok: #2f6f4e;
    --ticket-orange: #f67b22;
    --ticket-orange-deep: #ea6b11;
    --ticket-dark: #13131a;
    --shadow: 0 14px 34px rgba(36,28,18,.08)
}

* {
    box-sizing: border-box
}

html {
    font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55
}

body {
    margin: 0
}

a {
    color: inherit
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 28px;
    background: rgba(255,253,248,.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line)
}

.brand {
    font-weight: 800;
    color: var(--ink);
    text-decoration: none;
    white-space: nowrap
}

.site-header nav {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1
}

.site-header nav a,.account-link {
    color: var(--muted);
    text-decoration: none;
    padding: 7px 10px;
    border-radius: 999px
}

.site-header nav a:hover,.account-link:hover {
    background: var(--accent2);
    color: var(--ink)
}

.header-account {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap
}

.logout {
    margin: 0
}

.logout button {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    padding: 7px 10px;
    border-radius: 999px;
    font: inherit
}

.logout button:hover {
    background: var(--accent2);
    color: var(--ink)
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 20px 80px
}

.hero,.panel,.auth-card,.notice {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 22px
}

.hero h1,.panel h1,.auth-card h1 {
    margin-top: 0;
    font-size: clamp(28px,4vw,46px);
    letter-spacing: -.04em
}

.panel h2 {
    margin-top: 0
}

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

.page-head h1 {
    font-size: 34px;
    margin: 0
}

.grid {
    display: grid;
    gap: 16px
}

.grid.two {
    grid-template-columns: repeat(2,minmax(0,1fr))
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap
}

.button,button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 15px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    font-weight: 700
}

.button.primary,button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white
}

.button.danger,button.danger {
    background: var(--danger);
    border-color: var(--danger);
    color: white
}

.button.small {
    padding: 6px 10px;
    font-size: 13px
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 12px
}

input,select,textarea {
    width: 100%;
    margin-top: 6px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: white;
    font: inherit
}

textarea {
    resize: vertical
}

.muted {
    color: var(--muted)
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(19,19,26,.08);
    font-size: 12px;
    font-weight: 800
}

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

.checkline input {
    width: auto;
    margin: 0
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 14px
}

.auth-card {
    max-width: 560px;
    margin-inline:auto}

.auth-card.wide {
    max-width: 980px
}

.field-help {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 400
}

.flash {
    border-radius: 16px;
    padding: 12px 15px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    background: white
}

.flash.success {
    border-color: #b8d6c4;
    background: #eef8f1
}

.flash.warning {
    border-color: #e1c16e;
    background: #fff8dc
}

.flash.danger {
    border-color: #e4aaaa;
    background: #fff0f0
}

.ticket-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(220px,1fr));
    gap: 18px;
    align-items: start
}

.dashboard-ticket-panels .ticket-grid {
    grid-template-columns: repeat(auto-fill,minmax(190px,1fr))
}

.ticket {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    width: 100%;
    aspect-ratio: 1/1.414;
    padding: 22px;
    border-radius: 4px;
    border: none;
    background: var(--ticket-orange);
    color: var(--ticket-dark);
    text-decoration: none;
    overflow: hidden;
    /* box-shadow:0 18px 42px rgba(26,20,14,.13); */
    transition: all 0.2s;
}

.ticket::before,.ticket::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg);
    /* border:1.8px solid rgba(15,15,20,.72); */
}

.ticket::before {
    top: -12px
}

.ticket::after {
    bottom: -12px
}

.ticket-button {
    appearance: none;
    cursor: pointer;
    font: inherit
}

.ticket-button:hover,.ticket-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 48px rgba(26,20,14,.18)
}

.ticket-meta {
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(19,19,26,.72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.ticket-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-top: 10px
}

.ticket-title {
    display: block;
    font-size: clamp(30px,3.2vw,44px);
    line-height: .98;
    /* letter-spacing:-.055em; */
    /* max-width:5.1em; */
    word-break: keep-all;
    line-height: 1.15;
}

.ticket-status {
    display: inline-flex;
    align-self: flex-start;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(19,19,26,.08);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap
}

.ticket-divider {
    height: 1px;
    background: black;
    margin: 16px 0
}

.ticket-divider-top {
    margin-top: 20px;
    margin-bottom: 18px
}

.ticket-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 0
}

.ticket-label {
    display: block;
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(19,19,26,.68);
    font-weight: 800
}

.ticket-info strong,.ticket-bottom strong,.ticket-footer span {
    display: block;
    font-size: 18px;
    line-height: 1.16;
    letter-spacing: -.02em
}

.ticket-info small {
    display: block;
    margin-top: 4px;
    color: rgba(19,19,26,.62);
    font-size: 12px
}

.ticket-spacer {
    flex: 1;
    min-height: 12px
}

.ticket-bottom,.ticket-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-end
}

.ticket-bottom span,.ticket-footer span:last-child {
    font-size: 14px;
    color: rgba(19,19,26,.72);
    text-align: right
}

.status-approved.ticket,.status-approved .ticket-modal-hero {
    background: var(--ticket-orange)
}

.status-pending.ticket,.status-pending .ticket-modal-hero {
    background: orange;
}

.status-rejected.ticket,.status-rejected .ticket-modal-hero,.status-cancelled.ticket,.status-cancelled .ticket-modal-hero {
    background: #d9d1c6;
    color: #2e2b27
}

.clean {
    padding-left: 0;
    list-style: none
}

.clean li {
    padding: 6px 0;
    border-bottom: 1px solid var(--line)
}

.small-list {
    font-size: 14px
}

.slot-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(120px,1fr));
    gap: 8px;
    margin: 12px 0 20px
}

.slot-btn {
    border: 1px solid var(--line);
    background: white;
    border-radius: 14px;
    padding: 10px;
    font-weight: 700
}

.slot-btn.disabled {
    background: #eee;
    color: #9b9489;
    cursor: not-allowed
}

.slot-btn.selected {
    background: var(--accent);
    color: white;
    border-color: var(--accent)
}

.slot-message {
    padding: 12px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--line);
    margin-top: 10px
}

.detail {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 10px 18px
}

.detail dt {
    font-weight: 800;
    color: var(--muted)
}

.detail dd {
    margin: 0
}

.table-wrap {
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow)
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 850px
}

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

th {
    background: #f8f1e6;
    font-size: 13px
}

.search {
    display: flex;
    gap: 10px;
    margin-bottom: 14px
}

.search input {
    margin: 0
}

.inline-form,.action-grid,.compact-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-top: 18px
}

.action-grid label {
    min-width: 280px;
    flex: 1
}

.week-grid {
    display: grid;
    grid-template-columns: repeat(7,minmax(160px,1fr));
    gap: 10px;
    overflow: auto
}

.day-col {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 12px;
    min-height: 360px
}

.day-col h3 {
    margin-top: 0
}

.schedule-item {
    display: block;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 14px;
    background: #f7efe2;
    text-decoration: none;
    color: var(--ink);
    border: 1px solid var(--line)
}

.markdown p:first-child {
    margin-top: 0
}

.markdown p:last-child {
    margin-bottom: 0
}

.settings-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px
}

.settings-nav a {
    padding: 9px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    text-decoration: none
}

.settings-nav a.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff
}

.settings-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(220px,1fr));
    gap: 16px
}

.settings-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
    text-decoration: none
}

.settings-card strong {
    font-size: 20px
}

.modal[hidden] {
    display: none
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17,17,21,.75);
    /* backdrop-filter:blur(4px); */
}

.modal-dialog {
    position: relative;
    max-width: 900px;
    max-height: calc(100vh - 48px);
    overflow: auto;
    margin: 24px auto;
    background: var(--surface);
    border-radius: 26px;
    box-shadow: 0 24px 70px rgba(0,0,0,.22)
}

.ticket-modal-dialog {
    padding: 0
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    background: rgba(255,255,255,.88);
    z-index: 2
}

.ticket-modal-hero {
    padding: 28px 28px 22px;
    border-radius: 26px 26px 0 0
}

.ticket-modal-hero h2 {
    margin: 10px 0 6px;
    font-size: 42px;
    line-height: .96;
    letter-spacing: -.05em
}

.modal-panel {
    margin: 0;
    border: 0;
    border-radius: 0 0 26px 26px;
    box-shadow: none
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px
}

.body-modal-open {
    overflow: hidden
}

.warning-state {
    background: #f0eadf
}

.warning-state.유효 {
    background: #e4f4e9;
    color: #1a603e
}

.warning-state.소멸,.warning-state.삭제됨 {
    background: #f5e0df;
    color: #7d1c1d
}

@media(max-width: 760px) {
    .site-header {
        align-items:flex-start;
        flex-direction: column
    }

    .header-account {
        width: 100%;
        justify-content: flex-end
    }

    .grid.two {
        grid-template-columns: 1fr
    }

    .detail {
        grid-template-columns: 1fr
    }

    .page-head {
        align-items: flex-start;
        flex-direction: column
    }

    .week-grid {
        grid-template-columns: 1fr
    }

    .container {
        padding: 20px 14px
    }

    .ticket {
        padding: 18px
    }

    .ticket-title {
        font-size: 36px
    }

    .ticket-info {
        grid-template-columns: 1fr
    }

    .modal-dialog {
        margin: 16px;
        max-height: calc(100vh - 32px)
    }
}
