:root {
    font-family: Inter, Arial, sans-serif;
    color: #172033;
    background: #eef2f7;
    font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }

.shell {
    width: min(920px, calc(100% - 28px));
    margin: 32px auto;
}

.client-shell {
    width: min(720px, calc(100% - 24px));
}

.panel {
    background: #fff;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    padding: clamp(20px, 4vw, 36px);
    box-shadow: 0 14px 42px rgba(20, 35, 60, .08);
    margin-bottom: 20px;
}

h1 {
    font-size: clamp(28px, 5vw, 42px);
    margin: 6px 0 18px;
    line-height: 1.08;
}

h2 { margin: 6px 0 0; }
.eyebrow { color: #2458d3; font-weight: 800; font-size: 12px; text-transform: uppercase; }
label { display: block; font-weight: 750; margin: 18px 0 8px; }

input[type="email"],
input[type="password"],
input[type="text"],
input[type="file"] {
    width: 100%;
    min-height: 50px;
    border: 1px solid #bec9d7;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
}

button {
    border: 0;
    border-radius: 8px;
    padding: 14px 18px;
    min-height: 50px;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
}

button:disabled { opacity: .55; cursor: default; }
.primary { background: #174bb8; color: #fff; }
.secondary { background: #e7ecf3; color: #172033; }
.danger-button { background: #fee4e2; color: #b42318; }
form .primary { width: 100%; margin-top: 24px; }
.message { min-height: 26px; margin-top: 15px; color: #334155; }
.danger-note {
    color: #b42318;
    font-weight: 850;
    margin: 14px 0 4px;
}
.hidden { display: none !important; }
.centre { text-align: center; }

.status-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
}

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

.top-actions h1 {
    margin-bottom: 0;
}

.badge {
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.badge.waiting { background: #fff2c7; color: #775300; }
.badge.signed { background: #d9f8e6; color: #116336; }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-tools { margin-top: 12px; }

.invoice-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.invoice-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    padding: 14px;
    background: #f8fafc;
}

.invoice-title {
    font-weight: 850;
    overflow-wrap: anywhere;
}

.invoice-meta {
    color: #667085;
    font-size: 13px;
    margin-top: 5px;
}

.invoice-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.invoice-actions button {
    min-height: 42px;
    padding: 10px 12px;
}

.empty-state {
    border: 1px dashed #bec9d7;
    border-radius: 8px;
    color: #667085;
    padding: 18px;
}

.details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 24px 0;
}

.details div {
    background: #f5f7fa;
    padding: 15px;
    border-radius: 8px;
}

.details dt { color: #667085; font-size: 13px; }
.details dd { margin: 5px 0 0; font-weight: 750; overflow-wrap: anywhere; }

canvas {
    display: block;
    width: 100%;
    height: min(44vh, 330px);
    border: 3px solid #172033;
    border-radius: 8px;
    background: #fff;
    touch-action: none;
    margin: 24px 0 15px;
}

.client-buttons {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 12px;
}

.client-buttons button {
    font-size: 19px;
    min-height: 58px;
}

.disabled-canvas {
    pointer-events: none;
    opacity: .45;
}

@media (max-width: 640px) {
    .shell { margin: 14px auto; }
    .details { grid-template-columns: 1fr; }
    .status-row { display: block; }
    .top-actions { display: block; }
    .top-actions button { margin-top: 14px; width: 100%; }
    .invoice-item { grid-template-columns: 1fr; }
    .invoice-actions { justify-content: stretch; }
    .invoice-actions button { width: 100%; }
    .badge { display: inline-block; margin-top: 12px; }
}
