.hidden {
    display: none !important;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #121317;
    color: #f2f4f8;
}

.top-bar {
    background: linear-gradient(90deg, #1f2a44, #243152);
    color: inherit;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.top-bar a,
.top-bar button {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dropdown {
    position: relative;
}

.dropdown-toggle::after {
    content: "▾";
    margin-left: 0.35rem;
    font-size: 0.8rem;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 110%;
    background: #1b2232;
    min-width: 200px;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    z-index: 10;
    border: 1px solid rgba(126, 153, 199, 0.3);
}

.dropdown-menu a {
    display: block;
    padding: 0.65rem 1.2rem;
    color: inherit;
    text-decoration: none;
    transition: background 0.2s ease;
}

.dropdown-menu a:hover {
    background: rgba(88, 119, 183, 0.25);
}

.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
    display: block;
}

.content {
    width: min(1800px, calc(100% - 2rem));
    max-width: none;
    margin: 2rem auto;
    padding: 0 1rem;
}

.panel {
    background: #1a1f2b;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(84, 107, 161, 0.35);
}

.panel-subtitle {
    color: #a6b4d6;
    margin-top: 0.35rem;
    font-size: 0.95rem;
}

.table-panel {
    padding: 0;
}

.panel-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0 1.5rem 1rem;
}

.panel-exports,
.panel-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.panel-actions a.panel-action-link,
.panel-actions button,
.panel-actions .stats-trigger {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid rgba(126, 153, 199, 0.45);
    background: rgba(51, 77, 132, 0.55);
    color: #f2f4f8;
    cursor: pointer;
    text-decoration: none;
}

.panel-actions a.panel-action-link:hover,
.panel-actions .stats-trigger:hover {
    background: rgba(82, 112, 173, 0.65);
}

.filter-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label,
.filter-label {
    font-weight: 600;
    color: #c1ceef;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05rem;
}

.filter-form input[type="text"] {
    max-width: 240px;
}

.filter-form input[list] {
    max-width: 220px;
}

.hour-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(42, 62, 104, 0.35);
    border: 1px solid rgba(84, 107, 161, 0.45);
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.pill input {
    accent-color: #4d6ed4;
}

.pill:hover {
    background: rgba(71, 103, 164, 0.55);
    transform: translateY(-1px);
}

.flight-link {
    background: none;
    border: none;
    color: #7fa8ff;
    cursor: pointer;
    font-weight: 600;
    padding: 0;
}

.flight-link:hover {
    text-decoration: underline;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.filter-actions button {
    padding: 0.6rem 1.3rem;
}

.link-reset {
    color: #a5b8f2;
    text-decoration: underline;
    cursor: pointer;
}

.link-reset:hover {
    color: #d4dcfa;
}

.table-panel .table-scroll {
    padding: 1rem 1.5rem;
}

.table-scroll {
    overflow: auto;
    max-height: none;
}

.panel.narrow {
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

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

.form label {
    font-weight: 600;
    color: #b8c6e8;
}

.form input[type="text"],
.form input[type="password"],
.form input[type="file"] {
    padding: 0.5rem;
    border: 1px solid rgba(108, 140, 197, 0.45);
    border-radius: 6px;
    background: #10131c;
    color: inherit;
}

.form input::file-selector-button {
    background: #2b3b63;
    border: none;
    color: #f2f4f8;
    padding: 0.45rem 0.9rem;
    border-radius: 4px;
    margin-right: 0.75rem;
    cursor: pointer;
}

.form button {
    padding: 0.75rem;
    background: linear-gradient(135deg, #3354a0, #4d6ed4);
    color: #f2f4f8;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.form button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(52, 93, 170, 0.35);
}

.handler-form {
    max-width: 520px;
}

.handler-form .form-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.handler-form input[name="company"] {
    text-transform: uppercase;
}

.flash-messages {
    list-style: none;
    padding: 0;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    border: 1px solid rgba(126, 153, 199, 0.35);
}

.flash.success {
    background: rgba(46, 125, 117, 0.25);
    border-color: rgba(74, 174, 165, 0.5);
}

.flash.danger {
    background: rgba(148, 40, 62, 0.25);
    border-color: rgba(204, 78, 102, 0.55);
}

.flash.warning {
    background: rgba(172, 121, 31, 0.25);
    border-color: rgba(226, 166, 63, 0.55);
}

.flash.info {
    background: rgba(64, 102, 173, 0.25);
    border-color: rgba(111, 147, 205, 0.5);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    color: #e4e8f5;
}

th,
td {
    border-bottom: 1px solid rgba(126, 153, 199, 0.25);
    padding: 0.6rem 0.65rem;
    text-align: left;
}

th {
    background: rgba(61, 88, 141, 0.45);
    position: sticky;
    top: 0;
    backdrop-filter: blur(4px);
}

tbody tr:nth-child(odd) {
    background: rgba(21, 28, 40, 0.65);
}

tbody tr:nth-child(even) {
    background: rgba(28, 36, 50, 0.65);
}

tbody tr:hover {
    background: rgba(70, 105, 174, 0.4);
}

.table-scroll input[type="text"] {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid rgba(126, 153, 199, 0.4);
    border-radius: 6px;
    background: rgba(15, 19, 30, 0.85);
    color: inherit;
}

.table-scroll input[type="number"],
.table-scroll select {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1px solid rgba(126, 153, 199, 0.4);
    border-radius: 6px;
    background: rgba(15, 19, 30, 0.85);
    color: inherit;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.inline-form {
    display: inline-flex;
    gap: 0.4rem;
}

.inline-form button,
.btn-danger {
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
}

.btn-danger {
    border: 1px solid rgba(255, 112, 112, 0.5);
    background: rgba(255, 84, 84, 0.2);
    color: #ffb4b4;
}

.btn-danger:hover {
    background: rgba(255, 84, 84, 0.35);
}

.motivo-pill {
    width: 100%;
    border-radius: 999px;
    border: 1px solid rgba(126, 153, 199, 0.5);
    background: rgba(58, 79, 133, 0.45);
    color: #e6ebff;
    padding: 0.35rem 0.8rem;
    cursor: pointer;
    font-weight: 600;
}

.motivo-pill:hover {
    background: rgba(102, 132, 209, 0.55);
}

.stringa-pill {
    width: 100%;
    border-radius: 6px;
    border: 1px dashed rgba(164, 187, 242, 0.6);
    background: rgba(35, 47, 78, 0.6);
    color: #f0f3ff;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    text-align: left;
}

.stringa-pill:hover {
    background: rgba(72, 99, 155, 0.65);
}

.stringa-popover {
    position: fixed;
    pointer-events: none;
    background: transparent;
    z-index: 210;
    transition: opacity 0.15s ease;
}

.stringa-popover.hidden {
    opacity: 0;
    visibility: hidden;
}

.stringa-popover-content {
    background: #141926;
    border: 1px solid rgba(140, 167, 222, 0.5);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    max-width: 320px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
    font-size: 0.9rem;
    white-space: pre-wrap;
}

.stats-table tr.stats-total-row {
    font-weight: 600;
    background: rgba(82, 112, 173, 0.2);
}

.motivo-popover {
    position: fixed;
    pointer-events: none;
    background: transparent;
    z-index: 200;
    transition: opacity 0.15s ease;
}

.motivo-popover.hidden {
    opacity: 0;
    visibility: hidden;
}

.motivo-popover-content {
    background: #151b28;
    border: 1px solid rgba(126, 153, 199, 0.4);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.55);
    min-width: 220px;
}

.motivo-popover-content h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.motivo-popover table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.motivo-popover th {
    text-align: left;
    padding: 0.2rem 0.4rem 0.2rem 0;
    background: none;
    border: none;
}

.motivo-popover td {
    text-align: right;
    padding: 0.2rem 0;
    border: none;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(11, 14, 22, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #161c29;
    border-radius: 14px;
    width: min(960px, 95%);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(88, 119, 183, 0.35);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

.modal-header,
.modal-footer {
    padding: 1rem 1.5rem;
    background: rgba(31, 43, 68, 0.75);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stats-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.stats-export-actions .panel-action-link {
    padding: 0.4rem 0.9rem;
    border-radius: 6px;
    border: 1px solid rgba(126, 153, 199, 0.45);
    background: rgba(51, 77, 132, 0.55);
    color: #f2f4f8;
    text-decoration: none;
}

.stats-export-actions .panel-action-link:hover {
    background: rgba(82, 112, 173, 0.65);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close,
.modal-close-secondary {
    background: none;
    border: none;
    color: #d6defc;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close-secondary {
    font-size: 1rem;
    text-decoration: underline;
}

.modal-close:hover,
.modal-close-secondary:hover {
    color: #fff;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-section h3 {
    margin-top: 0;
    font-size: 1.05rem;
    color: #aebded;
}

.modal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.modal-table th,
.modal-table td {
    border-bottom: 1px solid rgba(126, 153, 199, 0.3);
    padding: 0.55rem 0.6rem;
    text-align: left;
}

.modal-table tbody tr:nth-child(odd) {
    background: rgba(24, 31, 46, 0.7);
}

.modal-table tbody tr:nth-child(even) {
    background: rgba(29, 36, 54, 0.7);
}

.stats-month-row .stats-month-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 0;
}

.stats-month-row .chevron {
    font-size: 0.9rem;
}

.stats-company-row td {
    background: rgba(14, 18, 28, 0.85);
}

.stats-company-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.88rem;
}

.stats-company-table th,
.stats-company-table td {
    border-bottom: 1px solid rgba(126, 153, 199, 0.3);
    padding: 0.45rem 0.5rem;
    text-align: left;
}

.stats-company-table thead th {
    background: rgba(61, 88, 141, 0.35);
}

.stats-empty {
    padding: 0.5rem 0;
    color: #d0d8f0;
    font-style: italic;
}

.modal-save {
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    border: none;
    background: linear-gradient(135deg, #4c7bff, #7297ff);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.2s ease, transform 0.1s ease;
}

.modal-save:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.modal-save:not(:disabled):hover {
    transform: translateY(-1px);
}

.modal-similar-form input[type="checkbox"] {
    transform: scale(1.1);
    accent-color: #7fa8ff;
}
