body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, #f5f9ff 0, #e6edf8 40%, #f8fafc 100%);
    color: #121826;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.main,
.app-main {
    flex: 1 0 auto;
    margin: 0 auto;
    max-width: 1120px;
    padding: 32px 0 48px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 16px;
    background-color: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

th,
td {
    padding: 10px 12px;
    font-size: 0.9rem;
    border-bottom: 1px solid #e2e8f0;
}

th {
    background: linear-gradient(to bottom, #f9fafb, #e2e8f0);
    text-align: left;
    font-weight: 600;
    color: #0f172a;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background-color: #f1f5f9;
}

/* pandas-generated report tables */
.table {
    margin-top: 16px;
    border: 1px solid #e2e8f0;
}

table.dataframe {
    border: 1px solid #e2e8f0;
}

.table thead th {
    background: linear-gradient(to bottom, #f9fafb, #e2e8f0);
}

.table tbody tr:hover {
    background-color: #f1f5f9;
}

/* ensure pandas tables use same light borders as trips (no heavy grid) */
.table th,
.table td,
table.dataframe th,
table.dataframe td {
    border-top: none;
    border-left: none;
    border-right: none;
}

.report-filters {
    margin-top: 8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.report-filters label {
    color: #475569;
}

.report-filters select {
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid #cbd5f5;
    background-color: #ffffff;
    font-size: 0.85rem;
}

/* prevent date column in reports table from wrapping */
.table th:first-child,
.table td:first-child {
    white-space: nowrap;
}

.actions {
    text-align: center;
    white-space: nowrap;
}

.app-header {
    background: linear-gradient(135deg, #0f172a, #1d4ed8);
    color: #ffffff;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.35);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    height: 40px;
    width: auto;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.45);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.brand-subtitle {
    font-size: 0.8rem;
    opacity: 0.9;
}

.main-nav ul {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 0;
    margin: 0;
}

.main-nav ul li {
    list-style: none;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.9rem;
    color: rgba(248, 250, 252, 0.9);
    text-decoration: none;
    border: 1px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.main-nav a:hover {
    background-color: rgba(15, 23, 42, 0.2);
    border-color: rgba(148, 163, 184, 0.6);
    color: #ffffff;
    transform: translateY(-1px);
}

.main-nav a:active {
    transform: translateY(0);
}

.app-footer {
    flex-shrink: 0;
    padding: 24px 0 18px;
}

.app-footer p {
    max-width: 100%;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    margin: 0;
    padding-top: 18px;
    font-size: 0.85rem;
    color: #64748b;
}

.app-footer a {
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 500;
}

.app-footer a:hover {
    text-decoration: underline;
}

.footer-label {
    margin-right: 4px;
}

/* report table */

.form-group {
    margin: 10px 0;
}

input[name="zoho_client_secret"],
input[name="zoho_client_id"] {
    width: 350px;
}

input[type="text"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.wide-textarea {
    width: 500px;
}

.form-box {
    border: 1px solid #ccc;
    padding: 10px;
    margin-bottom: 20px;
    width: 100%;
}

/* generic button styles (used in reports table) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.78rem;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease,
        box-shadow 0.15s ease;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-0.5px);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

/* single color for all report buttons */
.btn-report {
    background-color: #101a37;
    border-color: #101a37;
    color: #ffffff;
}

.btn-report:hover {
    background-color: #17204a;
    border-color: #17204a;
}

/* smaller destructive button for delete actions */
.btn-delete {
    background-color: #b91c1c;
    border-color: #991b1b;
    color: #ffffff;
    padding: 2px 8px;
    font-size: 0.75rem;
}

.btn-delete:hover {
    background-color: #991b1b;
    border-color: #7f1d1d;
}

/* flash messages */
.flash-container {
    margin-bottom: 24px;
}

.flash {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 10px;
    border: 1px solid transparent;
}

.flash-info {
    background-color: #e0f2fe;
    border-color: #7dd3fc;
    color: #075985;
}

/* home page tweaks */
.home h2 {
    margin-top: 0;
    margin-bottom: 18px;
}

.home ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.home ul li a {
    display: block;
    padding: 12px 14px;
    border-radius: 10px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    text-decoration: none;
    color: #0f172a;
    font-size: 0.95rem;
    transition: box-shadow 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

.home ul li a:hover {
    border-color: #93c5fd;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.12);
    transform: translateY(-1px);
}

/* login page */
.login .auth-card {
    max-width: 420px;
    margin: 32px auto 0;
    padding: 24px 24px 22px;
    border-radius: 16px;
    background-color: rgba(248, 250, 252, 0.98);
    border: 1px solid #e2e8f0;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
}

.auth-title {
    margin: 0 0 6px;
}

.auth-subtitle {
    margin: 0 0 18px;
    font-size: 0.9rem;
    color: #64748b;
}

.auth-error {
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background-color: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: 0.9rem;
}

.auth-form .form-group {
    margin-bottom: 14px;
}

.auth-form label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: #475569;
}

.auth-form input[type="text"],
.auth-form input[type="password"] {
    width: 100%;
    box-sizing: border-box;
}

.auth-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

.btn-auth-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: 999px;
    border: none;
    background-color: #101a37;
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.45);
    transition: box-shadow 0.15s ease, transform 0.1s ease, background 0.15s ease;
}

.btn-auth-primary:hover {
    background-color: #17204a;
    box-shadow: 0 14px 32px rgba(37, 99, 235, 0.55);
    transform: translateY(-1px);
}

.btn-auth-primary:active {
    transform: translateY(0);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.45);
}

/* add-trip: form + flights panel side by side */
.add-trip-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 24px 32px;
    align-items: flex-start;
    margin: 24px 0 32px;
}

.add-trip-layout .add-trip-form {
    flex: 0 1 760px;
    min-width: 0;
}

.add-trip-flights {
    flex: 1 1 320px;
    min-width: 280px;
    padding: 20px 22px;
    border-radius: 16px;
    background-color: rgba(248, 250, 252, 0.98);
    border: 1px solid #e2e8f0;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
}

.add-trip-flights h3 {
    margin: 0 0 12px;
    font-size: 1.05rem;
    color: #0f172a;
}

.flights-hint {
    margin: 0;
    font-size: 0.875rem;
    color: #64748b;
}

.flights-loading,
.flights-error {
    font-size: 0.9rem;
    margin: 0 0 8px;
}

.flights-error {
    color: #b91c1c;
}

.flights-none {
    margin: 0;
    font-size: 0.9rem;
    color: #64748b;
}

.add-trip-flights .flights-table {
    margin-top: 0;
    font-size: 0.85rem;
}

.add-trip-flights .flights-section {
    margin-top: 16px;
}

.add-trip-flights .flights-section:first-of-type {
    margin-top: 0;
}

.add-trip-flights .flights-section-title {
    margin: 0 0 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
}

.add-trip-flights .flights-table th,
.add-trip-flights .flights-table td {
    padding: 6px 10px;
}

.add-trip-flights .btn-select-price {
    padding: 4px 10px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.airport-and-rates {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.airport-and-rates .btn-retrieve-rates {
    margin-bottom: 0;
    flex-shrink: 0;
}

/* form card (add/edit trip and similar forms) */
.form-card {
    max-width: 560px;
    margin: 24px 0 32px;
    padding: 24px 24px 22px;
    border-radius: 16px;
    background-color: rgba(248, 250, 252, 0.98);
    border: 1px solid #e2e8f0;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
}

.add-trip-layout .form-card {
    max-width: none;
    margin: 0;
}

.edit-trip .form-card {
    max-width: 900px;
}

.form-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.form-card-header h2 {
    margin: 0;
    flex-shrink: 0;
}

.form-card-header-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.form-card-header-meta .form-text {
    margin: 0;
    font-size: 0.875rem;
    color: #475569;
    text-align: right;
}

.form-card h2 {
    margin: 0 0 18px;
    font-size: 1.45rem;
    color: #0f172a;
}

.form-card .form-section {
    margin: 16px 0 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #0f172a;
}

.form-card .form-section:first-of-type {
    margin-top: 0;
}

.form-card .form-group {
    margin-bottom: 14px;
}

.form-card .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.5rem;
    align-items: flex-end;
    margin-bottom: 14px;
}

.form-card .form-row .form-group {
    margin-bottom: 0;
}

.form-card .input-amount,
.form-card .input-amount-4,
.form-card input.input-amount,
.form-card input.input-amount-4 {
    width: 8ch;
    max-width: 8ch;
    box-sizing: content-box;
}

.form-card .input-qty {
    width: 3ch;
    max-width: 3ch;
    box-sizing: content-box;
}

.form-card .input-airport {
    width: 4.5em;
    min-width: 4.5em;
    box-sizing: content-box;
}

.form-card .label-hint {
    font-weight: normal;
    color: #94a3b8;
}

.form-card .report-location a {
    color: #2563eb;
    text-decoration: none;
}

.form-card .report-location a:hover {
    text-decoration: underline;
}

.form-card label,
.form-card .form-label {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: #475569;
}

.form-card input[type="text"],
.form-card input[type="number"],
.form-card .form-select {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    background-color: #ffffff;
}

.form-card input[type="number"].input-amount,
.form-card input[type="number"].input-amount-4 {
    width: 8ch;
    max-width: 8ch;
    box-sizing: content-box;
}

.form-card input[type="number"].input-qty {
    width: 3ch;
    max-width: 3ch;
    box-sizing: content-box;
}

.form-card input[type="text"]:focus,
.form-card input[type="number"]:focus,
.form-card .form-select:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.25);
}

.form-card .form-select {
    cursor: pointer;
}

.form-card .form-actions {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-card .btn-report {
    padding: 8px 18px;
    font-size: 0.9rem;
}

.trips .btn-add-trip {
    padding: 11px 22px;
    font-size: 1.07rem;
    text-decoration: none;
}

.form-card~.back-link,
.trip-form-back {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.9rem;
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 500;
}

.form-card~.back-link:hover,
.trip-form-back:hover {
    text-decoration: underline;
}

/* user settings form (uses form-card, wider and full form styling) */
.user-form .form-card--wide {
    max-width: 720px;
}

.form-card .form-control,
.form-card input.form-control {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    background-color: #ffffff;
}

.form-card .form-control:focus,
.form-card input.form-control:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.25);
}

.form-card textarea.form-control,
.form-card .form-control--wide {
    width: 100%;
    min-height: 2.5em;
    resize: vertical;
}

.form-card textarea.form-control {
    min-height: 6em;
}

.form-card input[type="file"].form-control-file {
    padding: 6px 0;
    font-size: 0.9rem;
    color: #475569;
}

.form-card .form-divider {
    border: 0;
    border-top: 1px solid #e2e8f0;
    margin: 24px 0 16px;
}

.form-card .form-info-box {
    padding: 12px 16px;
    margin-bottom: 20px;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #475569;
}

.form-card .form-text.text-muted {
    display: block;
    margin-top: 4px;
    font-size: 0.8rem;
    color: #64748b;
}