/* Table and form styles aligned with condomini-saas-2/resources/css/admin.css. */
/* Form MVP: stessa identità visiva del form pubblico Bignova. */
:root {
    --bn-form-yellow: #ffff99;
    --bn-form-blue: #0d4f98;
    --bn-form-text: #1f2a37;
    --bn-form-muted: #807e7e;
    --bn-form-input: #fff;
    --bn-form-font: "Roboto", "Segoe UI", Arial, sans-serif;
}

body, button, input, select, textarea { font-family: var(--bn-form-font); }

.form-panel, .filter-panel {
    border: 2px solid #000;
    border-radius: 25px;
    background: var(--bn-form-yellow);
    padding: 40px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, .08);
}

.form-section-title {
    color: var(--bn-form-text);
    font-family: var(--bn-form-font);
    font-size: 24px;
    font-weight: 800;
}

.form-field label {
    color: var(--bn-form-text);
    font-family: var(--bn-form-font);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.15;
}

.form-field input:not([type="checkbox"]), .form-field select,
.form-field textarea, main form select {
    min-height: 60px;
    border: 2px solid #000;
    border-radius: 18px;
    background: var(--bn-form-input);
    color: #000;
    font-family: var(--bn-form-font);
    font-size: 18px;
    line-height: 1.15;
    padding: 0 20px;
}

.form-field textarea { min-height: 110px; padding-block: 15px; }
.form-field input:disabled, .form-field select:disabled { background: #f3f3f3; color: #999; }

.form-field input:focus, .form-field select:focus, .form-field textarea:focus,
main form select:focus {
    outline: none;
    border: 2px solid #e69a00;
    background: #fff;
    box-shadow: 0 0 8px #ffcf00;
}

.form-actions button, .button {
    min-height: 60px;
    border-radius: 30px;
    background: var(--bn-form-blue);
    color: #fff;
    font-family: var(--bn-form-font);
    font-size: 22px;
    font-weight: 600;
    text-transform: none;
}

.form-actions button:hover, .button:hover { background: #08396f; }
.small-muted { color: var(--bn-form-muted); font-family: var(--bn-form-font); }


/* Compact tables, including the empty state. */
.table-wrap { overflow: auto; border: 1px solid #eaeaea; border-radius: 0; background: #fff; box-shadow: none; }
.table-wrap table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14px; }
table th, table td { border-bottom: 1px solid #ddd; padding: 8px 5px; vertical-align: top; text-transform: uppercase; }
table th, table th * { text-transform: uppercase !important; }
table th { background: #ffff99; color: #333; text-align: center; font-size: 14px; font-weight: 800; letter-spacing: .055em; }
table td { text-align: left; }
table tbody tr:hover { background: rgba(66, 139, 202, .09); }
table tbody tr:last-child td { border-bottom: 0; }
.condomini-empty { padding: 8px 5px; }
.condomini-empty p { margin: 8px 0; font-size: 14px; }

/* Entity forms use the same label / control alignment as the reference. */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 30px; }
.entity-form .form-field-wide { grid-column: 1 / -1; display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 20px; }
.entity-form .form-field-wide label { margin: 0; }
.entity-form .form-field input:not([type="checkbox"]), .entity-form .form-field select, .entity-form .form-field textarea { width: 100%; max-width: 100%; min-width: 0; }
.entity-form .form-field input[name="codice_fiscale"] { max-width: 360px; }
.entity-form .form-field input[name="cap"], .entity-form .form-field input[name="provincia"], .entity-form .form-field input[name="comune"] { width: 41.667%; }
.entity-form .form-section-title { grid-column: 1 / -1; margin: 10px 0 0; text-align: center; text-transform: uppercase; }
main .button, .form-actions button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px !important; border-radius: 10px !important; padding: 0 12px !important; font-size: 14px !important; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.form-actions .form-cancel { order: -1; margin-right: auto; background: #d92d20 !important; }
.form-actions .form-cancel:hover { background: #a51b12 !important; }
.form-actions .form-save { background: #198754 !important; }
.form-actions .form-save:hover { background: #146c43 !important; }
.form-actions .form-save:disabled { opacity: .55; color: #fff; cursor: not-allowed; }
.form-actions .form-save:disabled:hover { background: #198754 !important; }
@media (max-width: 700px) {
    .entity-form .form-field-wide { grid-template-columns: 130px minmax(0, 1fr); }
    .entity-form .form-field input[name="cap"], .entity-form .form-field input[name="provincia"], .entity-form .form-field input[name="comune"] { width: 100%; }
}
@media (max-width: 560px) {
    .form-panel, .filter-panel { padding: 25px 20px; }
    .form-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .form-field label { font-size: 18px; }
    .form-field input:not([type="checkbox"]), .form-field select, .form-field textarea { font-size: 16px; height: auto; }
}
@media (max-width: 420px) {
    .entity-form .form-field-wide { grid-template-columns: minmax(0, 1fr); gap: 7px; }
}
.form-panel .form-actions .form-save, .form-panel .form-actions .form-cancel { width: auto; flex: 0 0 auto; }

.entity-form select { height: 60px; }
.entity-form input[type="file"] { height: auto; padding: 14px; }
.entity-form .form-field-wide > div { min-width: 0; }
.entity-form .small-muted.form-field-wide { display: block; }
.panel dd { overflow-wrap: anywhere; }

.supplier-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.supplier-filter-dialog { width: min(620px, calc(100% - 30px)); max-height: calc(100% - 30px); padding: 0; border: 0; border-radius: 25px; background: transparent; }
.supplier-filter-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.supplier-filter-dialog .form-panel { margin: 0; max-width: none; padding: 28px; }
.supplier-filter-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.supplier-filter-header h2 { margin: 0; }
.supplier-dialog-close { width: 42px; min-width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--bn-form-blue); color: white; font-size: 28px; cursor: pointer; }
.supplier-filter-dialog .form-field { margin-bottom: 16px; }
.supplier-filter-dialog input, .supplier-filter-dialog select { width: 100%; min-width: 0; }
.supplier-actions { display: flex; flex-wrap: wrap; gap: 6px; max-width: 220px; }
.supplier-actions .button:disabled { opacity: .5; cursor: not-allowed; }
.supplier-table td { line-height: 1.6; overflow-wrap: anywhere; }
.supplier-table .supplier-contacts { text-transform: none; }

/* Mirror the supplier form field widths and bank row used by New Branch. */
.supplier-form .form-field input:not([type="checkbox"]), .supplier-form .form-field select { width: 75%; }
.supplier-form .form-field input[name="vat_number"], .supplier-form .form-field input[name="tax_code"],
.supplier-form .form-field input[name="communications_address"], .supplier-form .form-field input[name*="[abi]"],
.supplier-form .form-field input[name*="[cab]"], .supplier-form .form-field input[name*="[account_number]"] { width: 100%; }
.supplier-form .form-field input[name="company_name"], .supplier-form .form-field input[name="address"],
.supplier-form .form-field input[name="email"], .supplier-form .form-field input[name="pec_email"],
.supplier-form .form-field input[name*="[address]"], .supplier-form .form-field input[name*="[email]"],
.supplier-form .form-field input[name*="[pec_email]"], .supplier-form .form-field input[name*="[bank]"],
.supplier-form .form-field input[name*="[iban]"] { width: 100%; }
.supplier-form .form-field input[name="region"], .supplier-form .form-field input[name="province"],
.supplier-form .form-field input[name="city"], .supplier-form .form-field input[name="cap"],
.supplier-form .form-field input[name*="[region]"], .supplier-form .form-field input[name*="[province]"],
.supplier-form .form-field input[name*="[city]"], .supplier-form .form-field input[name*="[cap]"] { width: 41.667%; }
.supplier-form .bank-short-fields-row { display: grid; grid-column: 1 / -1; grid-template-columns: .35fr .25fr .4fr; gap: 20px 30px; }
.supplier-form .bank-short-fields-row .form-field-wide { display: grid; grid-template-columns: 70px minmax(0, 1fr); align-items: center; gap: 12px; grid-column: auto; }
.supplier-form .bank-short-fields-row .form-field-wide label { margin: 0; }
.supplier-form .bank-short-fields-row .form-field-wide:has(input[name*="[abi]"]) { grid-template-columns: 70px minmax(0, 1fr); gap: 12px; }
.supplier-form .bank-short-fields-row input[name*="[abi]"], .supplier-form .bank-short-fields-row input[name*="[cab]"] { width: 100%; min-width: 0; }
.supplier-form .bank-short-fields-row input[name*="[account_number]"] { width: 100%; min-width: 0; }
@media (max-width: 700px) {
    .supplier-form .form-field input:not([type="checkbox"]), .supplier-form .form-field select { width: 100%; }
    .supplier-form .form-field input[name="region"], .supplier-form .form-field input[name="province"],
    .supplier-form .form-field input[name="city"], .supplier-form .form-field input[name="cap"],
    .supplier-form .form-field input[name*="[region]"], .supplier-form .form-field input[name*="[province]"],
    .supplier-form .form-field input[name*="[city]"], .supplier-form .form-field input[name*="[cap]"] { width: 100%; }
    .supplier-form .bank-short-fields-row { grid-template-columns: 1fr; }
    .supplier-form .bank-short-fields-row .form-field-wide { grid-template-columns: 130px minmax(0, 1fr); }
}

/* Supplier fields follow the two-column rows used by the SaaS branch form. */
.supplier-form .form-field:has([name="vat_number"]), .supplier-form .form-field:has([name="tax_code"]),
.supplier-form .form-field:has([name="phone"]), .supplier-form .form-field:has([name="mobile_phone"]),
.supplier-form .form-field:has([name="email"]), .supplier-form .form-field:has([name="pec_email"]) { grid-column: span 1; }
.supplier-form .form-field:has([name="vat_number"]) input, .supplier-form .form-field:has([name="tax_code"]) input,
.supplier-form .form-field:has([name="phone"]) input, .supplier-form .form-field:has([name="mobile_phone"]) input,
.supplier-form .form-field:has([name="email"]) input, .supplier-form .form-field:has([name="pec_email"]) input { width: 100%; min-width: 0; }
.supplier-form .form-field:has([name="tax_code"]) label, .supplier-form .form-field:has([name="mobile_phone"]) label,
.supplier-form .form-field:has([name="pec_email"]) label, .supplier-form .form-field:has([name="province"]) label,
.supplier-form .form-field:has([name="cap"]) label { text-align: right; }
.supplier-form .location-fields-row, .supplier-form .location-city-cap-row {
    display: grid; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 30px;
}
.supplier-form .location-fields-row .form-field-wide, .supplier-form .location-city-cap-row .form-field-wide {
    display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 20px; grid-column: auto;
}
.supplier-form .location-fields-row .form-field-wide label, .supplier-form .location-city-cap-row .form-field-wide label { margin: 0; }
.supplier-form .location-fields-row .location-city-field { grid-column: 1 / -1; }
.supplier-form .location-fields-row select, .supplier-form .location-city-cap-row select { width: 100%; min-width: 0; }
@media (max-width: 700px) {
    .supplier-form .form-field:has([name="vat_number"]), .supplier-form .form-field:has([name="tax_code"]),
    .supplier-form .form-field:has([name="phone"]), .supplier-form .form-field:has([name="mobile_phone"]),
    .supplier-form .form-field:has([name="email"]), .supplier-form .form-field:has([name="pec_email"]) { grid-column: 1 / -1; }
    .supplier-form .form-field:has([name="tax_code"]) label, .supplier-form .form-field:has([name="mobile_phone"]) label,
    .supplier-form .form-field:has([name="pec_email"]) label, .supplier-form .form-field:has([name="province"]) label,
    .supplier-form .form-field:has([name="cap"]) label { text-align: left; }
    .supplier-form .location-fields-row, .supplier-form .location-city-cap-row { grid-template-columns: 1fr; }
    .supplier-form .location-fields-row .form-field-wide, .supplier-form .location-city-cap-row .form-field-wide { grid-template-columns: 130px minmax(0, 1fr); }
    .supplier-form .location-fields-row .location-city-field { grid-column: auto; }
}
@media (max-width: 420px) {
    .supplier-form .location-fields-row .form-field-wide, .supplier-form .location-city-cap-row .form-field-wide { grid-template-columns: 1fr; gap: 7px; }
}

/* Match the ABI, CAB and account number alignment in the SaaS branch forms. */
.supplier-form .bank-short-fields-row .form-field-wide:has(input[name*="[abi]"]) { grid-template-columns: 180px minmax(0, 1fr); gap: 20px; }
.supplier-form .bank-short-fields-row input[name*="[abi]"],
.supplier-form .bank-short-fields-row input[name*="[cab]"] { width: 36.667%; min-width: 0; }
.supplier-form .bank-short-fields-row input[name*="[account_number]"] { width: 33.333%; min-width: 0; justify-self: end; }
.supplier-form .bank-short-fields-row .form-field-wide:has(input[name*="[cab]"]) label,
.supplier-form .bank-short-fields-row .form-field-wide:has(input[name*="[account_number]"]) label { text-align: right; }
@media (max-width: 700px) {
    .supplier-form .bank-short-fields-row .form-field-wide:has(input[name*="[abi]"]) { grid-template-columns: 130px minmax(0, 1fr); gap: 20px; }
    .supplier-form .bank-short-fields-row input[name*="[abi]"],
    .supplier-form .bank-short-fields-row input[name*="[cab]"],
    .supplier-form .bank-short-fields-row input[name*="[account_number]"] { width: 100%; }
}

.condominium-form .condominium-location-row,
.condominium-form .condominium-contact-row {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 30px;
}
.condominium-form .form-field-wide { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 20px; }
.condominium-form .form-field-wide label { margin: 0; }
.condominium-form .form-field-wide input,
.condominium-form .form-field-wide select { width: 100%; min-width: 0; }
@media (max-width: 700px) {
    .condominium-form .condominium-location-row,
    .condominium-form .condominium-contact-row { grid-template-columns: 1fr; }
    .condominium-form .form-field-wide { grid-template-columns: 130px minmax(0, 1fr); }
}
@media (max-width: 420px) {
    .condominium-form .form-field-wide { grid-template-columns: 1fr; gap: 7px; }
}

.subject-form .subject-pair-row, .subject-form .subject-location-row {
    display: grid; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 30px;
}
.subject-form .form-field-wide { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 20px; }
.subject-form .form-field-wide label { margin: 0; }
.subject-form .form-field-wide input:not([type="file"]), .subject-form .form-field-wide select { width: 100%; min-width: 0; }
.subject-form .form-field-wide > div { min-width: 0; }
.subject-form .subject-attachment-field { align-items: start; }
.subject-form .subject-attachment-field label { padding-top: 14px; }
.subject-form .subject-location-row select { width: 100%; min-width: 0; }
@media (max-width: 700px) {
    .subject-form .subject-pair-row, .subject-form .subject-location-row { grid-template-columns: 1fr; }
    .subject-form .form-field-wide { grid-template-columns: 130px minmax(0, 1fr); }
    .subject-form .subject-location-row .form-field-wide { grid-template-columns: 130px minmax(0, 1fr); }
}
@media (max-width: 420px) {
    .subject-form .form-field-wide, .subject-form .subject-location-row .form-field-wide { grid-template-columns: 1fr; gap: 7px; }
    .subject-form .subject-attachment-field label { padding-top: 0; }
}

/* Shared alignment standard for every two-field row in entity forms. */
.entity-form .form-pair-row:not(.bank-short-fields-row),
.entity-form .location-fields-row:not(.bank-short-fields-row),
.entity-form .location-city-cap-row:not(.bank-short-fields-row) {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 20px 30px;
}
.entity-form .form-pair-row:not(.bank-short-fields-row) > .form-field-wide,
.entity-form .location-fields-row:not(.bank-short-fields-row) > .form-field-wide,
.entity-form .location-city-cap-row:not(.bank-short-fields-row) > .form-field-wide {
    display: grid;
    grid-column: auto;
    grid-template-columns: 180px minmax(0, 1fr);
    align-items: center;
    gap: 20px;
    min-width: 0;
}
.entity-form .form-pair-row:not(.bank-short-fields-row) > .form-field-wide > label,
.entity-form .location-fields-row:not(.bank-short-fields-row) > .form-field-wide > label,
.entity-form .location-city-cap-row:not(.bank-short-fields-row) > .form-field-wide > label {
    margin: 0;
    text-align: left;
}
.entity-form .form-pair-row:not(.bank-short-fields-row) > .form-field-wide input,
.entity-form .form-pair-row:not(.bank-short-fields-row) > .form-field-wide select,
.entity-form .location-fields-row:not(.bank-short-fields-row) > .form-field-wide input,
.entity-form .location-fields-row:not(.bank-short-fields-row) > .form-field-wide select,
.entity-form .location-city-cap-row:not(.bank-short-fields-row) > .form-field-wide input,
.entity-form .location-city-cap-row:not(.bank-short-fields-row) > .form-field-wide select {
    width: 100%;
    min-width: 0;
}
@media (max-width: 700px) {
    .entity-form .form-pair-row:not(.bank-short-fields-row),
    .entity-form .location-fields-row:not(.bank-short-fields-row),
    .entity-form .location-city-cap-row:not(.bank-short-fields-row) { grid-template-columns: 1fr; }
    .entity-form .form-pair-row:not(.bank-short-fields-row) > .form-field-wide,
    .entity-form .location-fields-row:not(.bank-short-fields-row) > .form-field-wide,
    .entity-form .location-city-cap-row:not(.bank-short-fields-row) > .form-field-wide { grid-template-columns: 130px minmax(0, 1fr); }
}
@media (max-width: 420px) {
    .entity-form .form-pair-row:not(.bank-short-fields-row) > .form-field-wide,
    .entity-form .location-fields-row:not(.bank-short-fields-row) > .form-field-wide,
    .entity-form .location-city-cap-row:not(.bank-short-fields-row) > .form-field-wide { grid-template-columns: 1fr; gap: 7px; }
}
