@font-face {
    font-family: "Roboto";
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url("fonts/roboto-latin.woff2") format("woff2");
}

@font-face {
    font-family: "Material Icons";
    font-style: normal;
    font-weight: 400;
    font-display: block;
    src: url("fonts/material-icons.woff2") format("woff2");
}

.material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

:root {
    --bg: #F2F2F3;            /*Fondo general*/
    --card-bg: #FFFFFF;       /*Tarjetas y contenedores*/
    --text: #1D1F20;          /*Texto principal*/
    --muted: #6B6D6F;         /*Texto secundario (subtítulos, ámbito)*/
    --accent: #2451B1;        /*Acento steel: "Gest", iconos, botones principales*/
    --total: #02023F;         /*Azul marino: TOTAL del presupuesto, títulos*/
    --highlight: #E7ECF9;     /*Resaltados suaves*/
    --dark: #183677;          /*Énfasis fuerte / hover*/
    --nav-active: #C8D6F3;
    --border: #C7C7CA;        /*Bordes y divisores*/
    --danger: #9C0909;         /*Errores*/
    --radio: 4px;               /*Radio de esquinas*/
    --height-nav: 4rem;
    --height-amount: 7rem;
    --height-total: 9rem;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Roboto', system-ui, sans-serif;
    line-height: 1.5;
}

main {
    width: 100%;
}

nav {
    display: flex;
    align-items: center;
    position: fixed;
    gap: 0.150rem;
    z-index: 100;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 0.5rem 0.5rem 0.5rem 0.5rem;
}

nav.main-nav {
    min-height: var(--height-nav);
}

.has-nav .page {
    padding-bottom: calc(var(--height-nav) + 1rem);
}

.page.has-bar {
    padding-bottom: calc(var(--height-amount) + 1rem);
}

.page.has-bar-total {
    padding-bottom: calc(var(--height-total) + 1rem);
}

ul {
    list-style: none;
    padding: 0;
    width: 100%;
}

ul.article-list {
    padding-bottom: var(--height-nav);
}

h4 {
    font-weight: 600;
    color: var(--muted);
    width: 100%;
}

label {
    font-weight: 500;
}

input, select, textarea {
    display: block;
    width: 100%;
    font: inherit;
    height: 2rem;
    background-color: var(--bg);
    border-radius: var(--radio);
    border: 1px solid var(--border);
}

textarea {
    min-height: 12rem;
    resize: vertical;
}

input:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radio);
}

.fab {
    position: fixed;
    bottom: calc(var(--height-nav) + 1rem);
    right: 1.5rem;
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--highlight);
    background-color: var(--accent);
    font-size: 1.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radio);
    z-index: 90;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 100ms ease, box-shadow 100ms ease;
}

.fab:active {
    transform: translateY(2px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

button {
    font: inherit;
}

.button {
    height: 2rem;
    border-radius: var(--radio);
    color: var(--highlight);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    border: none;
    text-decoration: none;
    cursor: pointer;
}

.button:active {
    transform: translateY(1px);
}

.button[hidden] {
    display: none;
}

.button-icon {
    width: 2rem;
    padding: 0;
}

.button-primary {
    background-color: var(--accent);
}

.button-danger {
    background-color: var(--danger);
}

.logo-title{
    display: flex;
}

.subtitle {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.page-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.page-title-summary {
    display: flex;
    justify-content: space-between;
    align-items: start;
    line-height: 1.2;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.back-title {
    display: flex;
    width: 100%;
    min-width: 0;
    gap: 1rem;
    align-items:center;
}

.back-title-summary {
    display: flex;
    width: 100%;
    min-width: 0;
    gap: 1rem;
    align-items: start;
}

.a-reset {
    text-decoration: none;
}

.share-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    padding: 1rem;

}

.button-reset {
    border: none;
    background-color: var(--card-bg);
    box-shadow: none;
    padding: 0;
    cursor: pointer;
    height: auto;
}

.a-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
    flex: 1;
    touch-action: manipulation;
}

.icon-nav {
    transition: font-variation-settings 150ms ease;
    color: var(--dark);
}

.a-nav-active .icon-nav {
    border-radius: 50%;
    background-color: var(--nav-active);
    font-variation-settings: 'FILL' 1;
}

.nav-text {
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1;
}

.a-nav-active .nav-text {
    border-radius: var(--radio);
    background-color: var(--nav-active);
}

.row-text {
    display: flex;
    gap: 1rem;
}

.row-description {
    padding-top: 1rem;
}

.cards-group {
    display: flex;
    gap: 1rem;
}

.card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radio);
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    min-height: 7rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 100ms ease, box-shadow 100ms ease;
}

.card-inside {
    display: flex;
    flex-direction: column;
}

.card:active {
    transform: translateY(2px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.card-name {
    color: var(--total);
}

.card-info {
    font-size: 0.75rem;
    color: var(--muted);
}

.row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    background-color: var(--card-bg);
    transition: background-color 150ms ease;
}

.row.row-static:hover,
.row.row-static:active {
    background-color: var(--card-bg);
}


.budget-row {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.budget-info {
    display: flex;
    flex-direction: column;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.budget-units {
    display: flex;
}

.button-units {
    border: none;
    background-color: var(--card-bg);
    box-shadow: none;
    padding-block: 0;
    padding-inline: 0;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    touch-action: manipulation;
}

span.icon-units {
    color: var(--accent);
    border-radius: var(--radio);
    font-size: 2rem;
}

input.units {
    text-align: center;
    width: 4ch;
    color: var(--text);
    background-color: var(--card-bg);
    border: none;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

@media (hover: hover) {
    .row:hover {
        background-color: var(--highlight);
    }
}

.row:active {
    background-color: var(--highlight);
}

.row:last-child, .budget-row:last-child{
    border-bottom: none;
}

.row-link {
    display: flex;
    flex-grow: 1;
    gap: 1rem;
    justify-content: space-between;
    text-decoration: none;
    color: inherit;
}

.row-delete {
    text-decoration: none;
    color: inherit;
}

.row-info {
    display: flex;
    flex-direction:column;
    flex: 1;
    min-width: 0;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.row-amount {
    display: flex;
    flex-shrink: 0;
    gap: 0.7rem;
    align-items: center;
}

.row-scope {
    text-align: right;
    width: 4.5rem;
    font-size: 0.80rem;
    color: var(--accent);
}

.article-scope {
    text-align: left;
}

.row-price {
    text-align: right;
    width: 11ch;
    color: var(--text);
    font-weight: 600;
    align-content: center;
    font-variant-numeric: tabular-nums;
}

.article-price {
    flex-shrink: 0;
}

.row-name {
    color: var(--text);
    font-weight: 400;
}

.row-meta {
    display: flex;
    gap: 0.5rem;
    font-size: 0.80rem;
    color: var(--muted);
}

.page {
    padding: 1rem;
    background-color: var(--card-bg);
    min-height: 100dvh;
}

.form {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
    background-color: var(--card-bg);
    padding-top: 1rem;
}

.box-vat {
    display: flex;
    width: 100%;
    min-height: 3.5rem;
    gap: 1rem;
    padding-bottom: 1rem;
}

.box-name {
    display: flex;
    align-items: center;
}

.box-button-vat {
    display: flex;
    width: 100%;
}

.box-button-vat input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.box-button-vat label {
    flex: 1;
    padding: 0.5rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radio);
    cursor: pointer;
}

.box-button-vat input:checked + label {
    background-color: var(--accent);
    color: var(--card-bg);
}

.box-button-vat input:focus-visible + label {
    outline: 2px solid var(--accent);
}

.name, .last-name, .tax-id, .phone, .validity-days, .price, .scope {
    flex-grow: 1;
    flex-basis: 12rem;
}

.validity-days {
    flex-grow: 1;
    flex-basis: 8rem;
    align-self: flex-start;
}

.address, .email {
    flex-grow: 1;
    flex-basis: 16rem;
}

.conditions {
    flex-grow: 1;
    flex-basis: 50rem;
    min-width: 100%;
}

.material-icons {
    display: flex;
    font-size: 1.5rem;
}

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

.icon-accent {
    font-size: 2rem;
    color: var(--accent);
}

.icon-cancel {
    color: var(--text);
}

.amount-bar-info {
    display: flex;
    position: fixed;
    z-index: 100;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    min-height: var(--height-amount);
    border-top: 1px solid var(--border);
    padding: 1rem;
}

.amount-column {
    display: flex;
    flex-direction: column;
    flex: 1.5;
    justify-content: center;
    gap: 0.25rem;
}

div.vat-column {
    display: flex;
    flex-direction: column;
    flex: 1;
    justify-content: space-around;
    align-items: end;
    gap: 0.25rem;
}

/* Chrome, Edge, Safari */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.close-box {
    padding-left: 1rem;
}

.title-header {
    min-width: 0;
}

.header-info {
    display: flex;
    gap: 0.25rem;
}

.header-client {
    color: var(--text);
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    
}

.header-worktype {
    color: var(--muted);
    flex-shrink: 0;
}

.amount-summary-info {
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 100;
    bottom: 0;
    left: 0;
    right: 0;
    color: var(--highlight);
    background-color: var(--total);
    min-height: var(--height-total);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem;
}

.bar-base {
    display: flex;
    justify-content: space-between;
}

.bar-vat {
    display: flex;
    justify-content: space-between;
    padding-bottom: 0.5rem;
}

.total-row {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 0.5rem;
}

.column-total {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.generate-button {
    display: flex;
    align-items: center;
}

.total-text {
    font-size: 0.75rem;
}

.total-amount {
    font-size: 1.75rem;
    font-weight: 500;
}

.row-meta.row-calc {
    gap: 0.2rem;
}

.confirm-dialog {
    margin: auto;
    border: 1px solid var(--border);
    border-radius: var(--radio);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 1.5rem;
    width: calc(100% - 2rem);
    max-width: 22rem;
}

.confirm-dialog::backdrop {
    background-color: rgba(2, 2, 63, 0.5);
}

.confirm-question {
    font-size: 1.2rem;
}

.confirm-note {
    font-size: 0.85rem;
    color: var(--muted);
}

.confirm-actions {
    display: flex;
    justify-content: end;
    gap: 1rem;
    margin-top: 1rem;
}

.button-outline {
    background-color: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.share-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 1rem;
}

.share-row {
    display: flex;
    gap: 0.5rem;
}

.share-row .button-primary {
    flex: 1;
}

.app-footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--muted);
}

.cookie-notice {
    margin: 1rem;
    padding: 1rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radio);
    font-size: 0.875rem;
}

.legal-page h3 {
    margin-top: 1.5rem;
}

.legal-page table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.legal-page th,
.legal-page td {
    border: 1px solid var(--border);
    padding: 0.5rem;
    text-align: left;
    vertical-align: top;
}

.legal-page th {
    background-color: var(--highlight);
}

.actions {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin-top: 1rem;
}

.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 100dvh;
    padding: 1rem;
    background-color: var(--bg);
}

.login-card {
    width: 100%;
    max-width: 24rem;
    padding: 2rem 1.5rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radio);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.login-card .logo-title {
    justify-content: center;
    margin: 0 0 1.5rem;
}

.login-card h2 {
    margin: 0;
    text-align: center;
}

.login-subtitle {
    margin: 0.25rem 0 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--muted);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form input {
    height: 2.5rem;
    margin-top: 0.25rem;
    padding: 0 0.75rem;
}

.login-button {
    width: 100%;
    height: 2.5rem;
    margin-top: 0.5rem;
}

.logo-img {
    display: block;
    width: auto;
    height: 2.5rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-weight: normal;
}

.checkbox-label input {
    width: auto;
    height: auto;
    margin-top: 0.25rem;
}

.legal-links {
    margin: 0 0 1rem;
    padding-left: 1.25rem;
}
