:root {
    --blue: #07345f;
    --gold: #f2aa00;
    --gold-soft: #fff6d9;
    --bg: #eef3f9;
    --surface: #ffffff;
    --line: #dbe3ee;
    --text: #172033;
    --muted: #64748b;
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    letter-spacing: 0;
}

a {
    color: var(--blue);
}

.app-shell {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.sidebar {
    padding: 22px 18px;
    border-right: 0;
    background: var(--blue);
}

.brand-block {
    display: grid;
    gap: 8px;
    margin-bottom: 28px;
    padding: 12px;
    border: 1px solid rgba(242, 170, 0, 0.36);
    border-left: 5px solid var(--gold);
    border-radius: 8px;
    background: #ffffff;
}

.brand-block img {
    width: 76px;
    height: 56px;
    object-fit: contain;
}

.brand-block strong {
    color: var(--blue);
    font-size: 18px;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar nav a {
    padding: 10px 12px;
    border-radius: 7px;
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
}

.sidebar nav a:hover {
    background: rgba(242, 170, 0, 0.18);
    color: #ffffff;
}

.content {
    min-width: 0;
    padding: 28px;
}

.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

h1,
h2 {
    color: var(--blue);
}

h1 {
    margin: 0;
    font-size: 28px;
}

h2 {
    margin: 0;
    font-size: 19px;
}

.alert-chip {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--gold-soft);
    color: var(--blue);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.danger-chip {
    background: #fff1f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(7, 52, 95, 0.06);
}

.stat {
    border-top: 4px solid var(--gold);
    padding: 16px;
}

.stat span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.stat strong {
    display: block;
    margin-top: 6px;
    color: var(--blue);
    font-size: 26px;
}

.panel {
    border-top: 4px solid var(--gold);
    padding: 18px;
}

.panel.narrow {
    max-width: 440px;
}

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

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #ffffff;
    color: var(--blue);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.btn.primary,
button.primary {
    border-color: var(--blue);
    background: var(--blue);
    color: #ffffff;
    box-shadow: inset 0 -3px 0 var(--gold);
}

.btn.primary:hover,
button.primary:hover {
    background: #052d52;
}

.danger-link {
    border-color: #fecaca;
    color: #b91c1c;
}

.card-list {
    display: grid;
    gap: 10px;
}

.care-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    border-radius: 8px;
    background: #ffffff;
}

.care-card strong,
.care-card span {
    display: block;
}

.care-card span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
}

.actions,
.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.emoji-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: -6px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.emoji-tools button {
    min-height: 32px;
    padding: 6px 10px;
    border-color: #d8e0ec;
    background: #ffffff;
    color: var(--blue);
    font-size: 13px;
}

.emoji-tools button:hover {
    border-color: var(--gold);
    background: var(--gold-soft);
}

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

.search-form {
    display: flex;
    gap: 8px;
    flex: 1;
    max-width: 520px;
}

input,
textarea {
    width: 100%;
    min-height: 38px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
}

textarea {
    resize: vertical;
    line-height: 1.4;
}

textarea.large-textarea {
    min-height: 210px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--blue);
    font-size: 13px;
    font-weight: 700;
}

.stack,
.edit-form {
    display: grid;
    gap: 14px;
}

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

.editor-grid {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(500px, 600px);
    gap: 18px;
    align-items: start;
}

.preview-panel {
    position: sticky;
    top: 18px;
    min-width: 0;
}

.preview-tabs {
    display: inline-flex;
    gap: 5px;
    margin-bottom: 8px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.preview-tabs button.active {
    border-color: var(--blue);
    background: var(--blue);
    color: #fff;
    box-shadow: inset 0 -3px 0 var(--gold);
}

.live-status {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.live-frame {
    width: 100%;
    height: calc(100vh - 140px);
    min-height: 640px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #e8edf4;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

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

.data-table th {
    color: var(--blue);
    font-size: 13px;
    border-bottom: 2px solid var(--gold);
}

.data-table tr.rating-up td {
    background: #f4fbf6;
}

.data-table tr.rating-down td {
    background: #fff7f7;
}

.data-table tr.rating-up td:first-child,
.data-table tr.rating-down td:first-child {
    border-left: 5px solid var(--blue);
}

.rating-cell {
    width: 260px;
    min-width: 240px;
}

.rating-stack {
    display: grid;
    gap: 7px;
}

.rating-form {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    order: -1;
}

.rating-button,
.rating-clear {
    width: 38px;
    min-width: 38px;
    min-height: 36px;
    padding: 0;
    border-radius: 7px;
    font-size: 17px;
    line-height: 1;
}

.rating-button {
    border-color: #d8e0ec;
    background: #ffffff;
}

.rating-button:hover {
    border-color: var(--blue);
    background: #f8fafc;
}

.rating-button.active {
    border: 2px solid var(--blue);
    box-shadow: 0 0 0 3px rgba(7, 52, 95, 0.18), inset 0 -3px 0 var(--gold);
    transform: translateY(-1px);
}

.rating-positive.active {
    background: #f0fdf4;
}

.rating-negative.active {
    background: #fff1f2;
}

.rating-clear {
    border-color: transparent;
    background: transparent;
    color: var(--muted);
    font-size: 18px;
}

.rating-clear:hover {
    border-color: var(--line);
    background: #f8fafc;
    color: var(--blue);
}

.rating-note-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rating-note-form input {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 13px;
}

.rating-note-save {
    min-height: 32px;
    padding: 0 9px;
    font-size: 12px;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.inline-form {
    display: inline-flex;
    gap: 5px;
}

.inline-form input {
    width: 180px;
    min-height: 32px;
    padding: 6px 8px;
}

.message {
    padding: 11px 13px;
    border-radius: 8px;
    font-weight: 700;
}

.message.success {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.message.error {
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #b91c1c;
}

.muted {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.source-tools {
    display: grid;
    grid-template-columns: 1fr minmax(220px, 320px) minmax(180px, 230px);
    gap: 12px;
    align-items: end;
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.source-copy {
    display: grid;
    gap: 5px;
}

.source-copy h2 {
    margin: 0;
}

.source-upload,
.source-analyze {
    display: grid;
    gap: 8px;
}

.request-tools {
    grid-template-columns: 1fr minmax(220px, 340px);
}

.request-edit-layout {
    display: grid;
    gap: 18px;
}

.request-edit-panel,
.analysis-panel {
    max-width: 1180px;
}

.request-edit-form {
    max-width: 960px;
}

.request-file-tools {
    align-items: center;
}

.request-file-list {
    display: grid;
    gap: 8px;
    margin-top: -4px;
}

.request-file-list article {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    border-radius: 8px;
    background: #fbfdff;
}

.request-file-list strong,
.request-file-list span {
    display: block;
}

.request-file-list span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.analysis-panel {
    display: grid;
    gap: 16px;
}

.analysis-head {
    display: grid;
    gap: 5px;
}

.analysis-intro {
    display: grid;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    border-radius: 8px;
    background: #fbfdff;
}

.analysis-intro strong {
    color: var(--blue);
}

.analysis-intro p {
    margin: 0;
    line-height: 1.5;
}

.analysis-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.analysis-facts article {
    min-height: 74px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.analysis-facts span,
.analysis-facts strong {
    display: block;
}

.analysis-facts span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.analysis-facts strong {
    margin-top: 6px;
    color: var(--blue);
    font-size: 15px;
}

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

.matching-editor {
    grid-template-columns: minmax(420px, 1fr) minmax(360px, 460px);
}

.match-side {
    position: sticky;
    top: 18px;
}

.analysis-summary,
.request-summary {
    display: grid;
    gap: 10px;
    margin-top: 12px;
    line-height: 1.45;
}

.analysis-summary dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 7px 10px;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdff;
}

.analysis-summary dt {
    color: var(--blue);
    font-weight: 700;
}

.analysis-summary dd {
    margin: 0;
    color: var(--text);
}

.section-title {
    margin-top: 16px;
    color: var(--blue);
    font-size: 13px;
    text-transform: uppercase;
}

.requirement-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.requirement-list article {
    display: grid;
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    border-radius: 8px;
    background: #ffffff;
}

.requirement-list strong {
    color: var(--blue);
}

.requirement-list span {
    width: fit-content;
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--gold-soft);
    color: var(--blue);
    font-size: 12px;
    font-weight: 700;
}

.requirement-list p,
.match-card p {
    margin: 0;
    line-height: 1.45;
}

.compact-list {
    margin: 8px 0 0;
    padding-left: 18px;
    line-height: 1.45;
}

.match-request-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.match-grid {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(500px, 1fr);
    gap: 18px;
    align-items: start;
}

.match-list {
    display: grid;
    gap: 12px;
    margin-top: 12px;
}

.match-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-left: 6px solid var(--gold);
    border-radius: 8px;
    background: #ffffff;
}

.match-card.high {
    border-left-color: #15803d;
}

.match-card.medium {
    border-left-color: var(--gold);
}

.match-card.low {
    border-left-color: #b91c1c;
}

.match-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.match-top strong,
.match-top span {
    display: block;
}

.match-top strong {
    color: var(--blue);
    font-size: 18px;
}

.match-top span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.match-score {
    min-width: 64px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--blue);
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    box-shadow: inset 0 -3px 0 var(--gold);
}

button:disabled,
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.upload-meter {
    display: grid;
    gap: 5px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 700;
}

.upload-meter div {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8eef6;
}

.upload-meter i {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: var(--gold);
    transition: width 0.18s ease;
}

.setup-body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 20px;
}

.setup-card {
    width: min(560px, 100%);
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.settings-note {
    margin-top: 12px;
}

.settings-panel {
    max-width: 920px;
}

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

.settings-box {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    border-radius: 8px;
    background: #fbfdff;
}

.setup-card.wide {
    width: min(840px, 100%);
}

.setup-logo {
    width: 92px;
    height: 70px;
    object-fit: contain;
}

code {
    padding: 2px 5px;
    border-radius: 4px;
    background: #f1f5f9;
}

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

.check-list li {
    margin: 8px 0;
}

.ok,
.bad {
    display: inline-flex;
    min-width: 58px;
    justify-content: center;
    margin-right: 8px;
    padding: 4px 7px;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.ok {
    background: #15803d;
}

.bad {
    background: #b91c1c;
}

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

    .preview-panel {
        position: static;
    }

    .source-tools {
        grid-template-columns: 1fr;
    }

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

    .matching-editor,
    .match-grid {
        grid-template-columns: 1fr;
    }

    .analysis-facts,
    .requirement-grid {
        grid-template-columns: 1fr;
    }

    .match-side {
        position: static;
    }

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

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

    .sidebar {
        border-bottom: 0;
    }

    .stats-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 18px;
    }

    .request-file-list article {
        align-items: flex-start;
        flex-direction: column;
    }
}
