:root {
    --bg: #f6f7f8;
    --panel: #fff;
    --text: #202124;
    --muted: #6f7478;
    --line: #dfe3e6;
    --brand: #e83b12;
    --brand-dark: #94160f;
    --ok: #147a42;
    --danger: #b42318;
    --radius: 8px;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
}
a { color: inherit; text-decoration: none; }
.topbar {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 10px 28px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand img { display: block; height: 52px; width: auto; }
.nav { display: flex; gap: 10px; flex-wrap: wrap; }
.nav a, .button, button {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
}
.nav a:hover, .button:hover, button:hover { border-color: var(--brand); }
.button.primary, button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.button.danger, button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.button.ok, button.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.button i, button i { margin-right: 6px; }
.button.icon-only, button.icon-only {
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.button.icon-only i, button.icon-only i { margin-right: 0; }
.button.icon-pair, button.icon-pair {
    min-width: 72px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.button.icon-pair i, button.icon-pair i { margin-right: 0; }
.a-regular.fa-bolt {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, Helvetica, sans-serif !important;
    font-style: normal;
    font-weight: 700;
    line-height: 1;
}
.a-regular.fa-bolt::before {
    content: none !important;
}
.meter-bolt-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 0;
}
.meter-bolt-icon::before {
    content: "";
    width: 16px;
    height: 16px;
    display: block;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='3' width='16' height='18' rx='2'/%3E%3Cpath d='M8 7h8M8 17h8'/%3E%3Cpath d='M12 10l-3 5h3l-1 4 4-6h-3l1-3z' fill='black' stroke='none'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='3' width='16' height='18' rx='2'/%3E%3Cpath d='M8 7h8M8 17h8'/%3E%3Cpath d='M12 10l-3 5h3l-1 4 4-6h-3l1-3z' fill='black' stroke='none'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}
.page { max-width: 1180px; margin: 0 auto; padding: 28px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box {
    width: min(420px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
}
.login-box img { display: block; width: 230px; max-width: 100%; margin: 0 auto 24px; }
.toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 20px; }
h1 { font-size: 28px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
}
.card h2 { margin: 0 0 6px; font-size: 20px; }
.contract-card { margin-top: 16px; }
.card-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.card-title-row h2 {
    min-width: 0;
    padding-right: 6px;
}
.delete-card-form {
    flex: 0 0 auto;
    margin: 0;
}
.button.icon-only.small-delete, button.icon-only.small-delete {
    width: 28px;
    height: 28px;
    font-size: 11px;
    padding: 0;
}
.meta { display: grid; gap: 6px; margin: 12px 0; color: var(--muted); }
.actions { display: flex; flex-wrap: nowrap; gap: 8px; margin-top: 14px; align-items: center; overflow: visible; padding-bottom: 2px; }
.actions form { margin: 0; flex: 0 0 auto; }
.actions .button, .actions button { flex: 0 0 auto; white-space: nowrap; }
.hidden-file { display: none; }
.center-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow-y: auto;
    background: rgba(20, 24, 28, .48);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}
.modal-open { overflow: hidden; }
.center-modal-card {
    width: min(520px, calc(100vw - 48px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    margin: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
    padding: 18px;
}
.center-modal-card h3 { margin: 0 0 4px; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
label { font-weight: 700; }
input, select {
    width: 100%;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font: inherit;
}
input[type="checkbox"] { width: auto; }
.checkline { display: flex; align-items: center; gap: 8px; min-height: 42px; }
.notice {
    padding: 12px;
    border: 1px solid #f3d0c8;
    background: #fff4f1;
    border-radius: 6px;
    margin-bottom: 16px;
}
.modal {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    max-width: 520px;
    width: calc(100% - 30px);
}
.modal::backdrop { background: rgba(0, 0, 0, .38); }
.modal h3 { margin-top: 0; }
.receipt {
    background: #fff;
    max-width: 720px;
    margin: 0 auto;
    padding: 24px;
}
.receipt-logo { height: 60px; display: block; margin: 0 auto 8px; }
.receipt table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.receipt th, .receipt td { border: 1px solid #d8d8d8; padding: 9px; text-align: left; }
.receipt th { background: #f4f4f4; }
.receipt .right { text-align: right; }
.signature { margin-top: 28px; text-align: center; }
.signature-image {
    display: block;
    width: 170px;
    max-width: 45%;
    max-height: 58px;
    object-fit: contain;
    margin: 0 auto 4px;
}
.print-actions { text-align: center; margin: 20px 0; }
@media (max-width: 720px) {
    .topbar { align-items: flex-start; height: auto; padding: 12px; flex-direction: column; }
    .page { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .toolbar { align-items: flex-start; flex-direction: column; }
    .center-modal { padding: 12px; }
    .center-modal-card { width: calc(100vw - 24px); max-height: calc(100vh - 24px); }
}
@media print {
    body { background: #fff; }
    .topbar, .print-actions { display: none !important; }
    .page { padding: 0; max-width: none; }
    .receipt { padding: 0; }
}
