:root {
    --bg: #f6f7f9;
    --card: #ffffff;
    --border: #d8dde6;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #1f5eff;
    --primary-dark: #1746ba;
    --danger: #dc2626;
    --soft-blue: #eef4ff;
    --soft-green: #ecfdf5;
    --soft-red: #fef2f2;
    --soft-orange: #fff7ed;
}

* { box-sizing: border-box; }

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    background: #111827;
    color: #fff;
    border-bottom: 1px solid #000;
}

.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 14px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    color: #fff;
    font-weight: bold;
    font-size: 18px;
}

.topbar nav {
    display: flex;
    gap: 16px;
}

.topbar nav a { color: #fff; }

.container {
    max-width: 1280px;
    margin: 28px auto;
    padding: 0 22px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 18px;
}

h1, h2, h3, h4 { margin-top: 0; }

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    margin-bottom: 14px;
    background: #fff;
}

textarea {
    min-height: 105px;
    font-family: Consolas, monospace;
}

input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

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

.btn {
    display: inline-block;
    border: none;
    background: var(--primary);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
}

.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn.secondary { background: #374151; }
.btn.light { background: #e5e7eb; color: #111827; }
.btn.danger { background: #b91c1c; }
.btn.success { background: #059669; }
.btn.small { padding: 8px 11px; font-size: 13px; }

.small { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }

.notice {
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--soft-green);
    border: 1px solid #a7f3d0;
    margin-bottom: 18px;
}

.error {
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--soft-red);
    border: 1px solid #fecaca;
    margin-bottom: 18px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e5e7eb;
    font-size: 12px;
}

.badge.blue { background: var(--soft-blue); color: #1d4ed8; }
.badge.green { background: var(--soft-green); color: #047857; }
.badge.orange { background: var(--soft-orange); color: #c2410c; }
.badge.red { background: var(--soft-red); color: #b91c1c; }

.stepper {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.step {
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    font-size: 13px;
    min-height: 72px;
}

.step.active {
    border-color: var(--primary);
    background: var(--soft-blue);
}

.step.done {
    border-color: #86efac;
    background: var(--soft-green);
}

.step .step-number {
    display: inline-flex;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    align-items: center;
    justify-content: center;
    background: #e5e7eb;
    font-weight: bold;
    margin-bottom: 8px;
}

.step.active .step-number { background: var(--primary); color: #fff; }
.step.done .step-number { background: #10b981; color: #fff; }

.wizard-step { display: none; }
.wizard-step.active { display: block; }

.step-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

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

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

.data-table th {
    background: #f8fafc;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-weight: bold;
}

.inline-check label { margin-bottom: 0; font-weight: bold; }

.row-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    background: #fafcff;
}

.sub-card {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 14px;
    margin-top: 12px;
    background: #fff;
}

.flowchart {
    overflow-x: auto;
}

.flow-line {
    display: flex;
    align-items: stretch;
    gap: 14px;
    flex-wrap: nowrap;
    margin-bottom: 14px;
    min-width: 820px;
}

.flow-branch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    min-width: 760px;
}

.flow-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.flow-box {
    min-width: 170px;
    background: #fff;
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    position: relative;
}

.flow-box.blue { border-color: #93c5fd; background: #eff6ff; }
.flow-box.green { border-color: #86efac; background: #ecfdf5; }
.flow-box.orange { border-color: #fdba74; background: #fff7ed; }
.flow-box.red { border-color: #fca5a5; background: #fef2f2; }
.flow-box.gray { border-color: #d1d5db; background: #f9fafb; }

.flow-box h3,
.flow-box h4 {
    margin: 0 0 8px 0;
    font-size: 15px;
}

.flow-box p {
    margin: 0 0 6px 0;
    font-size: 13px;
}

.arrow {
    display: flex;
    align-items: center;
    font-size: 24px;
    color: #64748b;
    padding: 0 4px;
}

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

.summary-list {
    margin: 0;
    padding-left: 18px;
}

.summary-list li {
    margin-bottom: 6px;
}

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

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

.status {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    background: #e5e7eb;
    font-size: 13px;
}

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

.print-section th, .print-section td {
    text-align: left;
    border: 1px solid var(--border);
    padding: 9px;
    vertical-align: top;
}

.print-section th {
    width: 240px;
    background: #f3f4f6;
}

pre {
    white-space: pre-wrap;
    font-family: Arial, sans-serif;
    margin: 0;
}

.signature-box {
    height: 90px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 10px;
}

.login-wrap {
    max-width: 430px;
    margin: 60px auto;
}

.hidden {
    display: none;
}

@media (max-width: 960px) {
    .grid, .grid-3, .grid-4, .summary-grid, .stepper { grid-template-columns: 1fr; }
    .flow-line, .flow-branch { min-width: 0; display: block; }
    .arrow { display: none; }
}

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

@media print {
    body { background: white; }
    .no-print { display: none !important; }
    .container { margin: 0; max-width: none; padding: 0; }
    .card { border: none; padding: 0; margin-bottom: 22px; page-break-inside: avoid; }
    .flow-box { break-inside: avoid; }
}
