html {
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    background: linear-gradient(180deg, #e7eef4 0%, #c7d8e5 100%);
    color: #163042;
}

img,
video,
iframe {
    max-width: 100%;
}

.auth-shell,
.dashboard-shell {
    min-height: 100vh;
    display: grid;
    padding: 32px 16px;
}

.auth-shell {
    place-items: center;
}

.dashboard-shell {
    align-content: start;
    justify-items: center;
}

.auth-card,
.dashboard-card {
    width: min(720px, 100%);
    background: #ffffff;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 20px 50px rgba(16, 44, 63, 0.16);
}

.dashboard-card {
    width: min(1120px, 100%);
}

.profile-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding: 14px;
    background: #eef5f9;
    border: 1px solid #d4e1ea;
    border-radius: 14px;
}

.profile-nav--full {
    width: 100%;
    justify-content: center;
}

.profile-nav__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #c6d8e4;
    color: #1d5f87;
    text-decoration: none;
    font-weight: 600;
}

.profile-nav__link:hover {
    background: #dcecf6;
    color: #164a69;
}

.profile-nav__link--active {
    background: #1d5f87;
    border-color: #1d5f87;
    color: #ffffff;
}

.profile-nav__link--active:hover {
    background: #164a69;
    color: #ffffff;
}

.profile-nav__link--logout {
    margin-left: auto;
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.8rem;
    color: #4d7086;
}

h1,
h2,
p {
    margin-top: 0;
}

.intro {
    color: #456173;
    line-height: 1.6;
}

.auth-form {
    display: grid;
    gap: 12px;
    margin: 24px 0;
}

.account-form {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.auth-form .field-help {
    margin: -4px 0 0;
    color: #547386;
    font-size: 0.92rem;
}

.account-form .field-help {
    margin: -4px 0 0;
    color: #547386;
    font-size: 0.92rem;
}

.auth-form input,
.auth-form button,
.account-form input,
.account-form button,
.account-form select,
.account-form textarea,
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    max-width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #aac0d1;
    font: inherit;
}

.auth-form button,
.account-form button,
.logout-link {
    border: none;
    background: #1d5f87;
    color: #ffffff;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.auth-form button:hover,
.account-form button:hover,
.logout-link:hover {
    background: #164a69;
}

.account-form input:disabled,
.account-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.account-form button:disabled:hover {
    background: #1d5f87;
}

.auth-switch {
    margin: -4px 0 24px;
    color: #456173;
}

.auth-switch a {
    color: #1d5f87;
    font-weight: 600;
}

.auth-switch a:hover {
    color: #164a69;
}

.hint-grid,
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.hint-grid article,
.dashboard-grid article {
    background: #f3f8fb;
    border: 1px solid #d9e6ee;
    border-radius: 12px;
    padding: 20px;
}

.danger-card {
    background: #fff6f6;
    border-color: #efc6c6;
}

.danger-button {
    background: #b93b3b;
}

.danger-button:hover {
    background: #8f2b2b;
}

.dashboard-header {
    display: flex;
    gap: 16px;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.notice {
    margin: 16px 0;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
}

.notice.success {
    background: #edf9f0;
    border-color: #b8e1c1;
    color: #1d5f2d;
}

.notice.error {
    background: #fff1f1;
    border-color: #efb7b7;
    color: #8b2323;
}

.notice.info {
    background: #eef6fb;
    border-color: #bed6e6;
    color: #234d66;
}

.meta {
    margin-top: 16px;
    color: #547386;
}

ul {
    margin: 0;
    padding-left: 18px;
}

li + li {
    margin-top: 8px;
}

/* Form Styles */
form {
    display: grid;
    gap: 24px;
}

fieldset {
    border: 1px solid #d9e6ee;
    border-radius: 10px;
    padding: 20px;
    margin: 0;
    background: #f9fbfd;
}

fieldset:first-child {
    margin-top: 0;
}

legend {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1d5f87;
    padding: 0 8px;
    margin: 0 0 16px -8px;
}

.form-group {
    display: grid;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    font-weight: 600;
    color: #163042;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    padding: 12px 14px;
    border: 1px solid #aac0d1;
    border-radius: 8px;
    font-family: inherit;
    font-size: inherit;
    color: #163042;
    background: #ffffff;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="tel"]:focus,
.form-group input[type="number"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #1d5f87;
    box-shadow: 0 0 0 3px rgba(29, 95, 135, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: Arial, sans-serif;
}

.form-group--checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-direction: row;
}

.form-group--checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin: 0;
}

.form-group--checkbox label {
    margin: 0;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-group,
.radio-group {
    display: grid;
    gap: 12px;
    margin-top: 8px;
}

.checkbox-item,
.radio-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-item input[type="checkbox"],
.radio-item input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin: 0;
    accent-color: #1d5f87;
}

.checkbox-item label,
.radio-item label {
    margin: 0;
    font-weight: normal;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #d9e6ee;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    font: inherit;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #1d5f87;
    color: #ffffff;
    border-color: #1d5f87;
}

.btn-primary:hover {
    background: #164a69;
    border-color: #164a69;
}

.btn-secondary {
    background: #f3f8fb;
    color: #1d5f87;
    border-color: #d9e6ee;
}

.btn-secondary:hover {
    background: #e7f1f7;
    border-color: #c0d5e3;
}

.inquiry-list {
    display: grid;
    gap: 14px;
}

.inquiry-item {
    background: #ffffff;
    border: 1px solid #d9e6ee;
    border-radius: 10px;
    padding: 14px;
}

.inquiry-item h3 {
    margin: 0 0 10px;
    color: #1d5f87;
    font-size: 1.05rem;
}

.inquiry-item p {
    margin: 0 0 8px;
}

.inquiry-item p:last-child {
    margin-bottom: 0;
}

.photo-manager {
    margin-top: 24px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.photo-card {
    border: 1px solid #d9e6ee;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
}

.photo-card__image {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    background: #eef5f9;
}

.photo-card__body {
    padding: 14px;
}

.photo-card__body p {
    margin-bottom: 8px;
}

.photo-card__delete {
    margin-top: 8px;
}

.invoice-layout {
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
    align-items: start;
}

.invoice-header-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.invoice-form-panel,
.invoice-recent-panel {
    background: linear-gradient(180deg, #f8fbfd 0%, #f1f6fa 100%);
    border: 1px solid #d7e2ea;
    border-radius: 16px;
    padding: 22px;
}

.invoice-form-panel h2,
.invoice-recent-panel h2 {
    margin-bottom: 18px;
}

.table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border: 1px solid #d9e6ee;
    border-radius: 12px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #d9e6ee;
    text-align: left;
    vertical-align: top;
}

.data-table thead th {
    background: #eef5f9;
    color: #1d5f87;
    font-weight: 700;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.invoice-items-table input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #aac0d1;
    border-radius: 8px;
    font: inherit;
}

.invoice-items-table {
    table-layout: fixed;
}

.invoice-items-table th:nth-child(1),
.invoice-items-table td:nth-child(1) {
    width: 56px;
    text-align: center;
}

.invoice-items-table th:nth-child(3),
.invoice-items-table td:nth-child(3),
.invoice-items-table th:nth-child(4),
.invoice-items-table td:nth-child(4) {
    width: 140px;
}

.invoice-items-table input[readonly],
#client_address[readonly] {
    background: #eef4f8;
    color: #36566d;
}

.invoice-form-panel textarea {
    min-height: 120px;
}

.invoice-form-panel #notes {
    min-height: 96px;
}

.invoice-list {
    display: grid;
    gap: 28px;
}

.invoice-card {
    background: #f3f8fb;
    border: 1px solid #d9e6ee;
    border-radius: 12px;
    padding: 18px;
}

.invoice-recent-panel .invoice-list {
    gap: 14px;
}

.invoice-recent-panel .invoice-card {
    background: #ffffff;
    border-color: #cfdce6;
    box-shadow: 0 8px 24px rgba(19, 43, 60, 0.05);
}

.invoice-recent-panel .invoice-card h3 {
    margin-bottom: 12px;
}

.invoice-recent-panel .invoice-card p {
    color: #314856;
    line-height: 1.55;
}

.invoice-recent-panel .invoice-card strong {
    color: #17384d;
}

.invoice-card h3,
.invoice-card h2 {
    margin-bottom: 10px;
    color: #1d5f87;
}

.invoice-card p:last-child {
    margin-bottom: 0;
}

.invoice-card__header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.invoice-total {
    font-size: 1.4rem;
    font-weight: 700;
    color: #163042;
    white-space: nowrap;
}

.invoice-card--detailed {
    background: #ffffff;
}

.invoice-entry {
    display: grid;
    gap: 12px;
}

.invoice-divider {
    width: 100%;
    border: 0;
    border-top: 1px solid #d9e6ee;
    margin: 0;
}

.invoice-sheet {
    background: #ffffff;
    border: 1px solid #d7dde3;
    box-shadow: 0 20px 50px rgba(18, 42, 59, 0.08);
    padding: 0 28px 28px;
}

.invoice-sheet__bar {
    height: 18px;
    background: #ff5a24;
    margin: 0 -28px 28px;
}

.invoice-sheet__bar--bottom {
    margin: 36px -28px 0;
}

.invoice-sheet__header {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    padding-bottom: 20px;
}

.invoice-brand {
    display: flex;
    gap: 18px;
    align-items: flex-start;
}

.invoice-brand__logo {
    width: 62px;
    height: 62px;
    border-radius: 999px;
    background: #6d6d6d;
    color: #ffffff;
    display: grid;
    place-items: center;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
}

.invoice-brand__details {
    max-width: 360px;
}

.invoice-brand__name {
    margin: 0 0 6px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #263746;
}

.invoice-brand__address {
    margin: 0;
    color: #5e6b76;
    line-height: 1.6;
}

.invoice-meta-card {
    min-width: 220px;
    text-align: right;
}

.invoice-meta-card h2 {
    margin: 0 0 18px;
    color: #9a9a9a;
    text-transform: uppercase;
    font-size: 2rem;
    font-weight: 500;
    letter-spacing: 0.06em;
}

.invoice-meta-card__row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 10px 0;
    border-bottom: 1px solid #d7dde3;
}

.invoice-meta-card__row span {
    color: #2d5080;
    font-size: 0.76rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.invoice-meta-card__row strong {
    color: #384450;
    font-weight: 600;
}

.invoice-sheet__summary {
    display: grid;
    gap: 20px;
    padding: 16px 0 24px;
}

.invoice-party-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.invoice-party-box h3 {
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #cfd7de;
    text-transform: uppercase;
    color: #2d5080;
    font-size: 0.9rem;
    letter-spacing: 0.03em;
}

.invoice-party-box p {
    margin: 0 0 8px;
    color: #24313c;
    line-height: 1.5;
}

.invoice-payment-terms {
    margin: 0;
    text-align: right;
    color: #596674;
    font-style: italic;
}

.invoice-summary-table-wrap {
    margin: 0 0 18px;
}

.invoice-summary-table thead th {
    background: #eef2f5;
    color: #2d5080;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
}

.invoice-summary-table {
    border: 1px solid #000000;
}

.invoice-summary-table td,
.invoice-summary-table th {
    border-right: 1px solid #000000;
    border-bottom: 1px solid #000000;
}

.invoice-summary-table td:last-child,
.invoice-summary-table th:last-child {
    border-right: none;
}

.invoice-summary-table tbody tr:last-child td {
    border-bottom: none;
}

.invoice-sheet__table-wrap {
    margin-top: 8px;
}

.invoice-table--template {
    border: 1px solid #000000;
    border-radius: 0;
}

.invoice-table--template thead th {
    background: #ff5a24;
    color: #ffffff;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
}

.invoice-table--template td,
.invoice-table--template th {
    border-right: 1px solid #000000;
    border-bottom: 1px solid #000000;
}

.invoice-table--template td:last-child,
.invoice-table--template th:last-child {
    border-right: none;
}

.invoice-table--template tbody tr:nth-child(even) td {
    background: #f6f6f6;
}

.invoice-table--template tbody td:nth-child(2),
.invoice-table--template tbody td:nth-child(3),
.invoice-table--template tbody td:nth-child(4) {
    text-align: right;
}

.invoice-sheet__footer {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr);
    gap: 28px;
    padding-top: 22px;
}

.invoice-remarks__label {
    margin: 0 0 10px;
    color: #3d4b56;
    font-weight: 600;
}

.invoice-remarks p:last-child {
    margin-bottom: 0;
    color: #495863;
    line-height: 1.6;
}

.invoice-totals {
    display: grid;
    gap: 0;
}

.invoice-totals__row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    padding: 7px 0;
    border-bottom: 1px solid #d7dde3;
    color: #394752;
}

.invoice-totals__row span {
    text-transform: uppercase;
    font-size: 0.8rem;
    font-weight: 700;
    color: #4a5a67;
}

.invoice-balance-due {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 16px;
    padding-top: 10px;
    border-top: 2px solid #111111;
}

.invoice-balance-due span {
    text-align: right;
    font-size: 1.5rem;
    font-weight: 700;
    color: #374654;
}

.invoice-balance-due strong {
    background: #f5d7d7;
    color: #111111;
    padding: 10px 16px;
    min-width: 140px;
    text-align: right;
    font-size: 1.7rem;
}

.invoice-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.invoice-actions .btn {
    width: auto;
    min-width: 180px;
}

@media (max-width: 1024px) {
    .auth-shell,
    .dashboard-shell {
        padding: 24px 12px;
    }

    .dashboard-card {
        width: 100%;
        padding: 24px;
    }

    .dashboard-grid,
    .hint-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }

    .profile-nav {
        gap: 10px;
    }

    .profile-nav__link {
        flex: 1 1 220px;
    }

    .invoice-sheet__header,
    .invoice-sheet__footer,
    .invoice-party-grid {
        gap: 20px;
    }
}

@media (max-width: 640px) {
    .auth-card,
    .dashboard-card {
        padding: 24px;
    }

    .dashboard-card {
        width: min(100%, 960px);
    }

    .dashboard-header {
        flex-direction: column;
    }

    .logout-link {
        width: 100%;
    }

    .profile-nav {
        flex-direction: column;
    }

    .profile-nav__link {
        width: 100%;
        flex-basis: auto;
    }

    .invoice-layout {
        grid-template-columns: 1fr;
    }

    .invoice-form-panel,
    .invoice-recent-panel {
        padding: 16px;
    }

    .invoice-items-table th:nth-child(3),
    .invoice-items-table td:nth-child(3),
    .invoice-items-table th:nth-child(4),
    .invoice-items-table td:nth-child(4) {
        width: 110px;
    }

    .invoice-card__header {
        flex-direction: column;
    }

    .invoice-sheet {
        padding: 0 16px 16px;
    }

    .invoice-sheet__bar {
        margin: 0 -16px 20px;
    }

    .invoice-sheet__bar--bottom {
        margin: 24px -16px 0;
    }

    .invoice-sheet__header,
    .invoice-party-grid,
    .invoice-sheet__footer {
        grid-template-columns: 1fr;
        display: grid;
    }

    .invoice-meta-card {
        min-width: 0;
        text-align: left;
    }

    .invoice-meta-card h2 {
        font-size: 1.5rem;
    }

    .invoice-payment-terms {
        text-align: left;
    }

    .invoice-balance-due {
        grid-template-columns: 1fr;
    }

    .invoice-balance-due span,
    .invoice-balance-due strong {
        text-align: left;
    }

    .profile-nav__link--logout {
        margin-left: 0;
    }

    fieldset {
        padding: 16px;
    }

    .form-actions,
    .dashboard-header,
    .invoice-card__header {
        flex-direction: column;
    }

    .form-actions,
    .dashboard-header {
        align-items: stretch;
    }

    .form-actions form {
        width: 100%;
    }

    .invoice-actions {
        justify-content: stretch;
    }

    .invoice-actions .btn {
        width: 100%;
        min-width: 0;
    }

    .account-form[style],
    form[style*="display:flex"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .data-table {
        min-width: 640px;
    }

    .btn {
        width: 100%;
    }
}

@media print {
    body {
        background: #ffffff;
    }

    .dashboard-card > .profile-nav,
    .dashboard-card > .dashboard-header,
    .dashboard-card > .notice,
    .invoice-divider,
    .invoice-actions,
    .invoice-entry:not(:has(.invoice-sheet--print-target)) {
        display: none !important;
    }

    .dashboard-shell,
    .dashboard-card,
    .invoice-list,
    .invoice-entry,
    .invoice-sheet {
        padding: 0;
        margin: 0;
        box-shadow: none;
        border: none;
        width: 100%;
        max-width: none;
        background: #ffffff;
    }
}
