* {
    box-sizing: border-box;
}

@font-face {
    font-family: "AuthPanelFont";
    src: url("../fonts/Aptos-SemiBold.ttf") format("truetype");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #eef1f6;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --text: #111827;
    --muted: #64748b;
    --line: #dfe5ec;
    --primary: #1d4ed8;
    --primary-dark: #1e40af;
    --accent: #2563eb;
    --danger: #dc2626;
    --success: #0f8f5f;
    --warning-bg: #fff7ed;
    --warning-text: #9a3412;
    --shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
    --shadow-soft: 0 7px 18px rgba(15, 23, 42, 0.045);
    --radius: 8px;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at 14% -12%, rgba(29, 78, 216, 0.10), transparent 30%),
        linear-gradient(180deg, #f7f9fc 0%, var(--bg) 44%, #e9edf4 100%);
    color: var(--text);
    font-family: "AuthPanelFont", Aptos, Arial, "Noto Sans Bengali", sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: var(--accent);
}

.container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 16px;
}

.topbar {
    background: rgba(17, 24, 39, 0.96);
    color: #fff;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(14px);
}

.topbar-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.nav a {
    color: #fff;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 700;
    transition: background .18s ease, transform .18s ease, border-color .18s ease;
}

.nav a:hover {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.22);
    transform: translateY(-1px);
}

.page-wrap {
    padding: 22px 16px 38px;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid rgba(148, 163, 184, 0.20);
    padding: 18px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    animation: uiCardIn 260ms ease both;
}

.card h1,
.card h2,
.card h3 {
    margin-top: 0;
    margin-bottom: 14px;
    color: var(--text);
    letter-spacing: 0;
    line-height: 1.2;
}

.login-wrap {
    min-height: calc(100vh - 90px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 420px;
}

.badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: var(--radius);
    background: #e5edff;
    color: #2346a0;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 12px;
}

.input,
select,
textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #d4dce8;
    border-radius: var(--radius);
    margin-top: 6px;
    margin-bottom: 14px;
    font-size: 14px;
    color: var(--text);
    background: #fbfdff;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.13);
    background: #fff;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #2563eb 0%, var(--primary) 100%);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    min-height: 40px;
    padding: 0 14px;
    cursor: pointer;
    font-family: "AuthPanelFont", Aptos, Arial, "Noto Sans Bengali", sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    letter-spacing: 0;
    text-shadow: none;
    box-shadow: 0 8px 18px rgba(29, 78, 216, 0.16);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.btn:hover {
    filter: brightness(0.98);
    transform: translateY(-1px);
    box-shadow: 0 11px 22px rgba(29, 78, 216, 0.22);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 6px 14px rgba(29, 78, 216, 0.17);
}

.btn-secondary {
    background: linear-gradient(180deg, #64748b 0%, #475569 100%);
    box-shadow: 0 8px 18px rgba(71, 85, 105, 0.14);
}

.btn-danger {
    background: linear-gradient(180deg, #ef4444 0%, var(--danger) 100%);
    box-shadow: 0 8px 18px rgba(220, 38, 38, 0.15);
}

.btn-success {
    background: linear-gradient(180deg, #10b981 0%, var(--success) 100%);
    box-shadow: 0 8px 18px rgba(15, 143, 95, 0.14);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.stat-box {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, 0.20);
    box-shadow: var(--shadow-soft);
}

.stat-title {
    color: #6b7280;
    font-size: 14px;
}

.stat-value {
    font-size: 26px;
    font-weight: bold;
    margin-top: 8px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-soft);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
}

table th {
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    letter-spacing: 0;
    text-transform: uppercase;
}

table th,
table td {
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 14px;
    vertical-align: top;
    overflow-wrap: anywhere;
}

table tr:last-child td {
    border-bottom: 0;
}

table tr:hover td {
    background: #f9fbff;
}

.alert {
    padding: 11px 13px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid transparent;
    font-weight: 700;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.mail-box {
    background: var(--surface-muted);
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: var(--radius);
    padding: 16px;
    white-space: normal;
    word-wrap: break-word;
}

label {
    display: inline-block;
    color: #334155;
    font-weight: 700;
    margin-bottom: 2px;
}

.dashboard-stats-grid,
.grid-3,
.grid-2 {
    align-items: stretch;
}

.dashboard-stat-card,
.mini-card,
.dash-card,
.simple-login-card,
.admin-login-card {
    border-radius: var(--radius) !important;
    border: 1px solid rgba(148, 163, 184, 0.20);
    box-shadow: var(--shadow) !important;
}

.dashboard-stat-card {
    border-left: 3px solid #1d4ed8;
    position: relative;
    overflow: hidden;
}

.dashboard-stat-card::after {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: linear-gradient(90deg, rgba(29,78,216,0.7), rgba(96,165,250,0));
}

.dashboard-stat-title,
.mini-label,
.stat-title {
    color: var(--muted) !important;
    font-weight: 700;
}

.dashboard-stat-value,
.mini-value,
.stat-value {
    color: var(--text);
    overflow-wrap: anywhere;
}

.edit-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.edit-actions form {
    margin: 0;
}

.mobile-topbar {
    background: linear-gradient(180deg, #111827 0%, #1f2937 100%) !important;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: sticky;
    top: 0;
    z-index: 20;
}

.mobile-brand {
    overflow-wrap: anywhere;
}

.support-link,
.primary-big-btn {
    background: var(--primary) !important;
    border-radius: var(--radius) !important;
    font-weight: 800 !important;
}

.top-right-link,
.btn-outline {
    border-radius: var(--radius) !important;
}

.dash-wrap {
    gap: 12px !important;
}

.dash-card {
    padding: 16px !important;
}

.dash-badge,
.saved-badge {
    border-radius: var(--radius) !important;
    background: #e9f0ff !important;
    color: #3b5ea7 !important;
}

.mini-alert {
    border-radius: var(--radius) !important;
    border: 1px solid transparent;
}

.mini-success {
    border-color: #bbf7d0;
}

.mini-error {
    border-color: #fecaca;
}

.history-item {
    border-radius: var(--radius) !important;
    border-color: var(--line) !important;
}

.history-subject,
.history-meta {
    overflow-wrap: anywhere;
}

.simple-login-wrap,
.admin-login-wrap {
    background: var(--bg);
}

body:not(.customer-app) .topbar {
    background: rgba(15, 23, 42, 0.96);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
    animation: uiTopbarIn 360ms ease both;
}

body:not(.customer-app) .brand {
    font-family: "AuthPanelFont", Aptos, Arial, "Noto Sans Bengali", sans-serif;
    font-weight: 600;
}

body:not(.customer-app) .page-wrap {
    max-width: 1120px;
    animation: uiPageIn 420ms ease 80ms both;
}

body:not(.customer-app) .card,
body:not(.customer-app) .stat-box,
body:not(.customer-app) .dashboard-stat-card,
body:not(.customer-app) .table-wrap {
    border-radius: 14px !important;
    border: 1px solid rgba(148, 163, 184, 0.20) !important;
    background: rgba(255, 255, 255, 0.94) !important;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.075) !important;
    backdrop-filter: blur(14px);
}

body:not(.customer-app) .card:hover,
body:not(.customer-app) .dashboard-stat-card:hover,
body:not(.customer-app) .stat-box:hover {
    transform: translateY(-1px);
}

body:not(.customer-app) .card,
body:not(.customer-app) .dashboard-stat-card,
body:not(.customer-app) .stat-box {
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

body:not(.customer-app) .nav a,
body:not(.customer-app) .btn {
    position: relative;
    overflow: hidden;
    font-family: "AuthPanelFont", Aptos, Arial, "Noto Sans Bengali", sans-serif !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    text-shadow: none !important;
    white-space: nowrap;
}

body:not(.customer-app) .btn::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,0.24) 42%, transparent 66%);
    transform: translateX(-120%);
    animation: uiButtonSheen 5.5s ease-in-out infinite;
    pointer-events: none;
}

body:not(.customer-app) table th {
    background: #f1f5f9;
}

body:not(.customer-app) table tr:hover td {
    background: #f8fbff;
}

body:not(.customer-app) table th,
body:not(.customer-app) table td {
    vertical-align: middle;
}

body:not(.customer-app) .action-group,
body:not(.customer-app) .actions-wrap {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(74px, 1fr));
    gap: 8px !important;
    align-items: center;
    width: max-content;
    max-width: 100%;
}

body:not(.customer-app) .action-group form,
body:not(.customer-app) .actions-wrap form {
    margin: 0 !important;
}

body:not(.customer-app) .action-group .btn,
body:not(.customer-app) .actions-wrap .btn {
    width: 100% !important;
    min-width: 74px !important;
    min-height: 40px !important;
    padding: 0 12px !important;
    margin: 0 !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

body:not(.customer-app) .edit-actions,
body:not(.customer-app) .copy-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

body:not(.customer-app) .log-filter-actions,
body:not(.customer-app) .log-danger-action {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 0;
}

body:not(.customer-app) .log-danger-action {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.20);
}

body:not(.customer-app) .edit-actions .btn,
body:not(.customer-app) .copy-actions .btn,
body:not(.customer-app) .log-filter-actions .btn,
body:not(.customer-app) .log-danger-action .btn {
    min-width: 138px;
}

@keyframes uiPageIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes uiTopbarIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes uiButtonSheen {
    0%, 72% { transform: translateX(-120%); }
    100% { transform: translateX(120%); }
}

@media (prefers-reduced-motion: reduce) {
    body:not(.customer-app) .topbar,
    body:not(.customer-app) .page-wrap,
    body:not(.customer-app) .card,
    body:not(.customer-app) .dashboard-stat-card,
    body:not(.customer-app) .stat-box,
    body:not(.customer-app) .btn::after {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }
}

@media (max-width: 768px) {
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .topbar-wrap {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .nav {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .nav a {
        text-align: center;
        padding: 10px 8px;
        white-space: normal;
    }

    .page-wrap {
        padding: 14px 10px 30px;
    }

    .card {
        padding: 15px;
    }

    table th,
    table td {
        padding: 10px;
        font-size: 13px;
    }

    .btn {
        width: 100%;
        margin-bottom: 6px;
    }

    .edit-actions,
    .edit-actions form {
        width: 100%;
    }

    body:not(.customer-app) .top-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    body:not(.customer-app) .mobile-topbar-inner {
        align-items: flex-start !important;
    }

    .mobile-brand {
        font-size: 15px !important;
        line-height: 1.35;
    }
}

@keyframes uiCardIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 460px) {
    .nav {
        grid-template-columns: 1fr;
    }

    body:not(.customer-app) .mobile-topbar-inner {
        flex-direction: column;
    }

    body:not(.customer-app) .top-actions,
    body:not(.customer-app) .support-link,
    body:not(.customer-app) .top-right-link {
        width: 100%;
    }

    body:not(.customer-app) .support-link,
    body:not(.customer-app) .top-right-link {
        display: block;
        text-align: center;
    }
}
