@font-face {
    font-family: "Mark";
    src: url("markpro-light.otf") format("opentype");
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Mark";
    src: url("markpro-book.otf") format("opentype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Mark";
    src: url("markpro-regular.otf") format("opentype");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Mark";
    src: url("markpro-medium.otf") format("opentype");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Mark";
    src: url("markpro-bold.otf") format("opentype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Mark";
    src: url("markpro-heavy.otf") format("opentype");
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Mark Small Caps";
    src: url("Mark-SmallCaps-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --page: #f4f3ee;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --field: #ffffff;
    --field-muted: #f8f7f3;
    --ink: #16160f;
    --ink-soft: #16160f;
    --intro: #6e6c61;
    --muted: #8a887e;
    --eyebrow: #9a9788;
    --placeholder: #a8a69a;
    --line: #e2e0d8;
    --card-line: #eae8e0;
    --line-strong: #16160f;
    --black: #16160f;
    --highlight: #ff5500;
    --green: #4cb16e;
    --step-1-bg: #ffe9e0;
    --step-1-border: #fbd4c5;
    --step-1-ink: #e64a00;
    --step-2-bg: #e6f4ff;
    --step-2-border: #cfe9fb;
    --step-2-ink: #1a8fe0;
    --step-3-bg: #fff7cc;
    --step-3-border: #fbefa3;
    --step-3-ink: #16160f;
    --step-4-bg: #e4f3ea;
    --step-4-border: #cde9d6;
    --step-4-ink: #3c9a5e;
    --focus: rgba(255, 85, 0, 0.28);
    --shadow: none;
    --radius-card: 18px;
    --radius-control: 11px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    background: var(--page);
    color: var(--ink);
    font-family: "Mark", Arial, Helvetica, sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.45;
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

.app-header {
    position: relative;
    max-width: 1240px;
    margin: 0 auto;
    padding: 54px 40px 40px;
}

.brand-lockup {
    margin-bottom: 16px;
}

.brand-lockup .eyebrow {
    margin: 0;
}

.hero-copy {
    max-width: 640px;
}

.title-lockup {
    display: flex;
    gap: 14px;
    align-items: center;
}

.title-logo {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border-radius: 9px;
}

.app-header h1 {
    margin: 0;
    color: var(--ink);
    font-size: 46px;
    font-weight: 300;
    line-height: 1.02;
    letter-spacing: 0;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--eyebrow);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1;
    text-transform: uppercase;
}

.intro {
    max-width: 640px;
    margin: 14px 0 0;
    color: var(--intro);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
}

.user-menu {
    position: absolute;
    top: 54px;
    right: 40px;
    display: flex;
    gap: 12px;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
}

.user-menu a {
    color: var(--ink);
    font-weight: 500;
    text-decoration: none;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px 16px;
}

.login-card {
    width: min(100%, 640px);
    padding: 34px;
    border: 1px solid var(--card-line);
    border-radius: var(--radius-card);
    background: var(--surface);
}

.login-card .eyebrow {
    margin: 0 0 10px;
    text-align: left;
}

.login-card .title-lockup {
    align-items: center;
}

.login-card h1 {
    margin: 0;
    color: var(--ink);
    font-size: 42px;
    font-weight: 300;
    line-height: 1.02;
    letter-spacing: 0;
}

.alert-message {
    margin: 20px 0 0;
    padding: 13px 15px;
    border: 1px solid #f0b7a0;
    border-radius: var(--radius-control);
    background: #fff0e8;
    color: #8a2d00;
    font-size: 13px;
    line-height: 1.45;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 40px 70px;
}

.ticket-form {
    display: grid;
    gap: 20px;
}

.form-section,
.preview-panel,
.smart-panel {
    background: var(--surface-raised);
    border: 1px solid var(--card-line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
}

.form-section {
    padding: 28px;
}

.section-heading {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    margin-bottom: 22px;
}

.section-heading h2,
.preview-header h2 {
    margin: 0;
    color: var(--ink-soft);
    font-size: 18px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0;
}

.section-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 14px;
    font-weight: 400;
}

.step {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--step-1-border);
    border-radius: 8px;
    background: var(--step-1-bg);
    color: var(--step-1-ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
}

.ticket-form .form-section:nth-of-type(2) .step {
    background: var(--step-2-bg);
    border-color: var(--step-2-border);
    color: var(--step-2-ink);
}

.ticket-form .form-section:nth-of-type(3) .step {
    background: var(--step-3-bg);
    border-color: var(--step-3-border);
    color: var(--step-3-ink);
}

.ticket-form .form-section:nth-of-type(4) .step {
    background: var(--step-4-bg);
    border-color: var(--step-4-border);
    color: var(--step-4-ink);
}

.field {
    display: grid;
    gap: 9px;
    margin: 0 0 20px;
}

.field:last-child {
    margin-bottom: 0;
}

.field span,
.choice-group legend {
    color: var(--ink);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.25;
    width: fit-content;
}

.required-marker {
    color: #b83800;
    text-decoration: none;
}

input[type="text"],
input[type="date"],
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--field);
    color: var(--ink);
    font-size: 14px;
    font-weight: 400;
    padding: 13px 15px;
    box-shadow: inset 0 1px 0 rgba(16, 16, 11, 0.02), 0 0 0 0 rgba(255, 85, 0, 0);
    transition: border-color 0.18s ease, box-shadow 0.22s ease, background 0.18s ease;
}

.project-picker,
.label-picker,
.user-picker {
    position: relative;
}

.project-results,
.label-results,
.user-results {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    display: grid;
    gap: 8px;
    max-height: 320px;
    overflow: auto;
    padding: 8px;
    border: 1px solid var(--card-line);
    border-radius: 13px;
    background: var(--surface);
}

.project-results[hidden],
.label-results[hidden],
.user-results[hidden] {
    display: none;
}

.project-option,
.label-option,
.user-option {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.project-option:hover,
.project-option:focus-visible,
.label-option:hover,
.label-option:focus-visible,
.user-option:hover,
.user-option:focus-visible {
    border-color: var(--line-strong);
    background: #fbfbf8;
    outline: none;
}

.label-option,
.user-option {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.label-option > span,
.user-option > span {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.user-avatar {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--field-muted);
    object-fit: cover;
}

.label-swatch {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    margin-top: 2px;
    border: 1px solid rgba(16, 16, 11, 0.12);
    border-radius: 999px;
}

.gitlab-label {
    display: inline-flex;
    max-width: 100%;
    align-items: stretch;
    border: 2px solid var(--line);
    border-radius: 999px;
    vertical-align: middle;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1;
    overflow: hidden;
}

.gitlab-label > span {
    width: auto;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.plain-label {
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
}

.scoped-label {
    min-height: 24px;
}

.scoped-label-key,
.scoped-label-value {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    padding: 5px 8px;
}

.scoped-label-key {
    flex: 0 1 auto;
    max-width: 150px;
    font-weight: 600;
}

.scoped-label-value {
    flex: 1 1 auto;
    background: var(--field-muted);
    color: var(--ink);
}

.project-option strong,
.project-option span,
.label-option strong,
.label-option small,
.user-option strong,
.user-option small {
    display: block;
}

.project-option strong,
.label-option strong,
.user-option strong {
    margin-bottom: 3px;
    font-size: 13.5px;
    font-weight: 500;
}

.project-option span,
.label-option small,
.user-option small,
.project-empty {
    color: var(--muted);
    font-size: 12.5px;
}

.selected-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 28px;
}

.selected-label,
.empty-label-selection {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    font-size: 12.5px;
}

.selected-label {
    gap: 7px;
    padding: 0 8px 0 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.selected-label:hover,
.selected-label:focus-visible {
    box-shadow: 0 0 0 3px var(--focus);
    outline: none;
}

.remove-label-icon {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
}

.empty-label-selection {
    color: var(--muted);
}

textarea {
    min-height: 94px;
    resize: vertical;
}

input::placeholder,
textarea::placeholder {
    color: var(--placeholder);
    font-weight: 400;
    opacity: 1;
}

input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus {
    outline: none;
    background: #ffffff;
    border-color: var(--line);
    box-shadow: inset 0 1px 0 rgba(16, 16, 11, 0.02), 0 0 2px 2px var(--focus);
}

input[readonly] {
    background: var(--field-muted);
    border-color: var(--card-line);
    color: var(--placeholder);
}

input[type="text"]:disabled,
input[type="date"]:disabled,
textarea:disabled {
    background: var(--field-muted);
    color: var(--muted);
    cursor: wait;
    opacity: 0.78;
}

.two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.choice-group {
    margin: 0 0 24px;
    padding: 0;
    border: 0;
}

.choice-grid,
.choice-stack {
    display: grid;
    gap: 12px;
    margin-top: 11px;
}

.choice-grid {
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
}

.check-option {
    display: flex;
    min-height: 46px;
    gap: 10px;
    align-items: center;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-control);
    background: var(--field);
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(16, 16, 11, 0.02), 0 0 0 0 rgba(255, 85, 0, 0);
    transition: border-color 0.18s ease, box-shadow 0.22s ease, background 0.18s ease;
}

.check-option:hover {
    border-color: var(--line-strong);
    background: #ffffff;
}

.check-option:has(input:checked) {
    border-color: var(--line);
    background: #ffffff;
    box-shadow: inset 0 1px 0 rgba(16, 16, 11, 0.02), 0 0 2px 2px var(--focus);
}

.check-option input {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    accent-color: var(--black);
}

.check-option span {
    color: var(--ink);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.15;
}

.optional-other {
    margin-top: -4px;
}

.conditional-field[hidden] {
    display: none;
}

.form-actions,
.preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.form-actions {
    padding-top: 4px;
}

.form-actions .button {
    padding: 14px 22px;
}

.form-actions .button.primary {
    padding: 14px 24px;
}

.button {
    display: inline-flex;
    min-height: 45px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    padding: 13px 22px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: wait;
    opacity: 0.68;
    transform: none;
}

.button:focus-visible {
    outline: 3px solid rgba(255, 85, 0, 0.28);
    outline-offset: 2px;
}

.button.primary {
    background: var(--black);
    color: #ffffff;
    border-color: var(--black);
}

.button.primary:hover {
    background: #000000;
    border-color: #000000;
    box-shadow: none;
}

.form-actions .button.primary::after {
    content: "\2192";
    color: var(--highlight);
    font-weight: 600;
}

#ai-fill-fields::after {
    content: "\2726";
    color: var(--highlight);
    font-weight: 600;
}

.button.secondary {
    background: #ffffff;
    color: var(--ink);
    border-color: var(--line);
    font-weight: 500;
}

.button.secondary:hover {
    border-color: var(--line-strong);
    box-shadow: none;
}

.compact-button {
    min-height: 31px;
    padding: 6px 11px;
    border-radius: 8px;
    font-size: 12.5px;
    white-space: nowrap;
}

.side-panel {
    position: sticky;
    top: 22px;
    display: grid;
    gap: 24px;
}

.preview-panel,
.smart-panel {
    padding: 28px;
}

.markdown-panel {
    padding: 0;
}

.preview-summary {
    display: block;
    padding: 28px;
    cursor: pointer;
    list-style: none;
}

.preview-summary::-webkit-details-marker {
    display: none;
}

.preview-summary .preview-header {
    margin-bottom: 0;
}

.preview-summary .preview-header::after {
    content: "\203A";
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin-left: 2px;
    color: var(--muted);
    font-size: 24px;
    line-height: 1;
    transform: rotate(90deg) scale(1.5, 1);
    transition: transform 0.16s ease;
}

.markdown-panel[open] .preview-summary {
    padding-bottom: 18px;
}

.markdown-panel[open] .preview-summary .preview-header::after {
    transform: rotate(270deg) scale(1.5, 1);
}

.preview-body {
    padding: 0 28px 28px;
}

.preview-header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 18px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    color: var(--intro);
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
}

.status-pill.muted {
    border-color: var(--line);
    background: #ffffff;
    color: var(--muted);
}

.smart-panel #ai-status-pill.muted {
    border-color: var(--highlight);
    background: #fff0e8;
    color: var(--ink);
}

.preview-panel .status-pill.muted::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--green);
}

.field.compact {
    margin-bottom: 18px;
}

.markdown-output {
    min-height: 360px;
    max-height: calc(100vh - 346px);
    margin-bottom: 18px;
    padding: 16px;
    background: #fbfbf8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 12.5px;
    line-height: 1.7;
    color: #2a2a22;
    white-space: pre;
}

.smart-input {
    min-height: 250px;
}

.helper-text {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.5;
}

.helper-text.is-error,
.copy-feedback.is-error {
    color: #a83a00;
}

.mail-panel {
    margin-bottom: 20px;
    padding: 16px;
    border: 1px solid var(--card-line);
    border-radius: 13px;
    background: #ffffff;
}

.mail-panel-header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    justify-content: space-between;
}

.mail-panel h3 {
    margin: 0;
    color: var(--ink);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0;
    line-height: 1.15;
}

.mail-panel p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
}

.mail-list {
    display: grid;
    gap: 9px;
    max-height: 320px;
    margin-top: 14px;
    overflow: auto;
    padding-right: 2px;
    padding-top: 10px;
}

.mail-item {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #ffffff;
    color: var(--ink);
    padding: 13px 14px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.mail-item:hover,
.mail-item:focus-visible {
    border-color: var(--line-strong);
    background: #fbfbf8;
    box-shadow: none;
    outline: none;
    transform: translateY(-1px);
}

.mail-item strong {
    display: block;
    margin-bottom: 4px;
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.18;
}

.mail-item span {
    display: block;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 400;
    line-height: 1.35;
}

.mail-item span:last-child {
    color: var(--placeholder);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px;
    margin-top: 3px;
}

.copy-feedback {
    min-height: 22px;
    margin: 10px 0 0;
    color: #39764c;
    font-size: 12.5px;
    font-weight: 600;
}

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

    .app-header {
        max-width: 760px;
    }

    .side-panel {
        position: static;
    }

    .markdown-output {
        max-height: none;
    }
}

@media (max-width: 680px) {
    body {
        font-size: 15px;
    }

    .app-header,
    .workspace {
        padding-right: 16px;
        padding-left: 16px;
    }

    .app-header {
        padding-top: 28px;
        padding-bottom: 20px;
    }

    .user-menu {
        position: static;
        margin-top: 16px;
        justify-content: space-between;
    }

    .title-lockup {
        gap: 10px;
        align-items: flex-start;
    }

    .title-logo {
        width: 31px;
        height: 31px;
        margin-top: 2px;
        border-radius: 8px;
    }

    .app-header h1 {
        font-size: 2.08rem;
    }

    .form-section,
    .preview-panel,
    .smart-panel {
        padding: 18px;
        border-radius: 14px;
    }

    .markdown-panel {
        padding: 0;
    }

    .preview-summary {
        padding: 18px;
    }

    .preview-body {
        padding: 0 18px 18px;
    }

    .section-heading {
        gap: 12px;
    }

    .two-column {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .choice-grid {
        grid-template-columns: 1fr;
    }

    .preview-header,
    .mail-panel-header {
        flex-direction: column;
        align-items: stretch;
    }

    .button,
    .preview-actions .button,
    .form-actions .button {
        width: 100%;
    }
}
