html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    margin: 0;
    padding: 0;
    background: #f8fafc;
    font-family: Segoe UI, Arial, sans-serif;
    overflow-x: hidden;
}

.wrapper,
.app-shell {
    display: flex;
    width: 100%;
    min-height: 100vh;
    align-items: stretch;
}

.sidebar,
.app-sidebar {
    width: 270px;
    flex: 0 0 270px;
    max-width: 270px;
    min-width: 270px;
    min-height: 100vh;
    background: #111827;
    color: #fff;
    padding: 20px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.main-content {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 100vh;
    width: auto;
    overflow-x: hidden;
}

.content-area {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.sidebar .list-group-item {
    background: transparent;
    color: #fff;
    border: none;
    margin-bottom: 8px;
    border-radius: 10px;
}

.sidebar .list-group-item:hover {
    background: #2563eb;
    color: #fff;
}

.logo {
    margin-bottom: 40px;
}

.logo h4 {
    margin: 0;
    font-weight: 700;
}

.logo small {
    opacity: .7;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar li {
    margin-bottom: 8px;
}

.sidebar a {
    display: block;
    padding: 12px 16px;
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    transition: .25s;
}

.sidebar a:hover {
    background: rgba(255, 255, 255, .08);
}

.sidebar li.active a {
    background: #2563eb;
}

.sidebar {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu-item {
    margin-bottom: 8px;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 0 16px;
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    transition: background-color 0.25s ease, transform 0.25s ease;
}

.sidebar-menu-link:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(2px);
}

.sidebar-menu-item.active .sidebar-menu-link {
    background: #2563eb;
}

.sidebar-menu-icon {
    width: 22px;
    flex: 0 0 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-menu-text {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 20px;
}

.sidebar-footer-divider {
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.08em;
    font-size: 0.9rem;
    margin-bottom: 18px;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-footer-label {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.65;
    margin-bottom: 6px;
}

.sidebar-footer-name {
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.4;
}

.sidebar-footer-version {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-top: 2px;
}

.topbar,
.navbar {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.container-fluid {
    min-width: 0;
}

.row {
    min-width: 0;
}

img,
svg,
video,
canvas {
    max-width: 100%;
}

@media (max-width: 991.98px) {
    .wrapper,
    .app-shell {
        flex-direction: column;
    }

    .sidebar,
    .app-sidebar {
        width: 100%;
        flex: 0 0 auto;
        max-width: none;
        min-width: 0;
        min-height: auto;
    }

    .main-content {
        min-height: auto;
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    body {
        overflow-x: hidden;
    }

    .sidebar,
    .app-sidebar {
        padding: 16px;
    }
}

.navbar-premium {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: #ffffff;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.navbar-premium .container-fluid {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.navbar-shell {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    min-height: 72px;
}

.navbar-row,
.navbar-left,
.navbar-center,
.navbar-right {
    min-width: 0;
}

.navbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

.navbar-left {
    flex: 0 0 auto;
}

.navbar-title {
    margin: 0;
    color: #111827;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.navbar-center {
    flex: 1 1 420px;
    display: flex;
    justify-content: center;
}

.navbar-search {
    position: relative;
    width: min(100%, 520px);
    flex: 1 1 auto;
}

.navbar-search-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: #6b7280;
    pointer-events: none;
    font-size: 0.95rem;
}

.navbar-search-input {
    height: 46px;
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: #f8fafc;
    padding-left: 40px;
    box-shadow: none;
}

.navbar-search-input:focus {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.1);
    background: #fff;
}

.navbar-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-left: auto;
}

.navbar-icon-btn,
.navbar-profile-btn {
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    color: #111827;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.navbar-icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.navbar-icon-btn:hover,
.navbar-profile-btn:hover,
.navbar-cta-btn:hover {
    background: #fff;
    color: #111827;
}

.navbar-profile-btn {
    min-height: 44px;
    padding: 6px 12px 6px 7px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.navbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: #2563eb;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    flex: 0 0 auto;
}

.navbar-profile-copy {
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.navbar-profile-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #111827;
}

.navbar-profile-role {
    font-size: 0.74rem;
    color: #6b7280;
}

.navbar-profile-caret {
    font-size: 0.72rem;
    color: #6b7280;
}

.navbar-profile {
    position: relative;
    display: flex;
    align-items: center;
}

.navbar-profile-menu {
    width: 100%;
}

.navbar-profile-menu.is-open {
    display: block;
}

.navbar-profile-menu[hidden] {
    display: none !important;
}

.navbar-profile-menu-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
    padding: 0 0 0.25rem;
}

.navbar-profile-item {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 14px;
    border: 0;
    border-radius: 12px;
    background: #f8fafc;
    color: #111827;
    text-align: left;
    font-size: 0.94rem;
    transition: background-color 0.2s ease;
}

.navbar-profile-item:hover {
    background: rgba(37, 99, 235, 0.06);
}

.navbar-cta-btn {
    min-height: 44px;
    padding: 0 16px;
    border-radius: 14px;
    font-weight: 600;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.18);
}

.dark-mode-toggle-active {
    background: #111827;
    color: #fff;
    border-color: #111827;
}

@media (max-width: 1199.98px) {
    .navbar-center {
        flex-basis: 320px;
    }
}

@media (max-width: 991.98px) {
    .navbar-shell {
        gap: 0.5rem;
    }

    .navbar-row {
        flex-wrap: wrap;
        row-gap: 0.75rem;
    }

    .navbar-search {
        width: 100%;
    }

    .navbar-center {
        order: 3;
        flex: 1 1 100%;
        width: 100%;
        justify-content: stretch;
    }

    .navbar-right {
        gap: 8px;
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 767.98px) {
    .navbar-premium {
        min-height: auto;
    }

    .navbar-premium .container-fluid,
    .navbar-shell {
        min-height: auto;
    }

    .navbar-title {
        font-size: 1rem;
    }

    .navbar-profile-btn {
        padding-right: 10px;
    }

    .navbar-cta-btn {
        padding-inline: 14px;
    }

    .navbar-profile-menu-inner {
        justify-content: stretch;
    }

    .navbar-profile-item {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 575.98px) {
    .navbar-right {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }
}

.dashboard-page {
    width: 100%;
    box-sizing: border-box;
}

.dashboard-hero,
.dashboard-section,
.dashboard-meta,
.dashboard-action-card {
    border-radius: 20px;
    background: #ffffff;
}

.dashboard-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.dashboard-title {
    color: #111827;
    font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.6rem);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.03em;
    max-width: 14ch;
}

.dashboard-subtitle {
    color: #6b7280;
    font-size: 1rem;
    line-height: 1.75;
    max-width: 58rem;
}

.dashboard-meta {
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.dashboard-meta-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.dashboard-meta-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.dashboard-meta-row:first-child {
    padding-top: 0;
}

.dashboard-meta-label {
    color: #6b7280;
    font-size: 0.9rem;
}

.dashboard-meta-value {
    color: #111827;
    font-size: 0.95rem;
    font-weight: 700;
    text-align: right;
}

.dashboard-section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 1rem;
}

.dashboard-section-title {
    color: #111827;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.dashboard-section-subtitle {
    color: #6b7280;
    font-size: 0.95rem;
}

.dashboard-action-card {
    display: block;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12) !important;
}

.dashboard-action-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    font-size: 1.2rem;
    margin-bottom: 16px;
}

.dashboard-action-title {
    color: #111827;
    font-size: 1rem;
    font-weight: 800;
}

.dashboard-action-text {
    color: #6b7280;
    font-size: 0.92rem;
    line-height: 1.6;
}

.dashboard-empty-state {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 280px;
    padding: 1rem;
    border-radius: 18px;
    border: 1px dashed rgba(15, 23, 42, 0.12);
    background: #f8fafc;
}

.dashboard-empty-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    font-size: 1.15rem;
    margin-bottom: 16px;
}

.dashboard-empty-title {
    color: #111827;
    font-size: 1.05rem;
    font-weight: 800;
}

.dashboard-empty-text {
    color: #6b7280;
    max-width: 34rem;
    line-height: 1.7;
}

.dashboard-status-list {
    display: grid;
    gap: 12px;
}

.dashboard-status-item {
    padding: 14px 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.dashboard-status-item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.dashboard-status-label {
    display: block;
    color: #6b7280;
    font-size: 0.84rem;
    margin-bottom: 6px;
}

.dashboard-status-value {
    display: block;
    color: #111827;
    font-size: 0.96rem;
    font-weight: 700;
    line-height: 1.55;
}

@media (max-width: 991.98px) {
    .dashboard-title {
        max-width: none;
    }

    .dashboard-section-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 575.98px) {
    .dashboard-hero,
    .dashboard-section,
    .dashboard-meta,
    .dashboard-action-card {
        border-radius: 18px;
    }

    .dashboard-meta-row {
        flex-direction: column;
    }

    .dashboard-meta-value {
        text-align: left;
    }
}

.ai-create-page {
    width: 100%;
    box-sizing: border-box;
}

.ai-create-hero,
.ai-create-panel,
.ai-create-result {
    border-radius: 20px;
    background: #ffffff;
}

.ai-create-title {
    color: #111827;
    font-size: clamp(1.6rem, 1.2rem + 1vw, 2.4rem);
    font-weight: 800;
    line-height: 1.15;
}

.ai-create-subtitle {
    color: #6b7280;
    font-size: 1rem;
    line-height: 1.7;
}

.ai-create-badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    font-size: 0.8rem;
    font-weight: 700;
}

.ai-create-label {
    color: #111827;
    font-weight: 600;
}

.ai-create-select,
.ai-create-textarea {
    border-radius: 14px;
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: none;
}

.ai-create-select:focus,
.ai-create-textarea:focus {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.1);
}

.ai-create-textarea {
    resize: vertical;
    min-height: 180px;
}

.ai-create-help {
    color: #6b7280;
    font-size: 0.88rem;
}

.ai-create-button,
.ai-create-copy {
    min-height: 44px;
    border-radius: 14px;
    font-weight: 600;
}

.ai-create-loading {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #2563eb;
    font-weight: 600;
    margin-bottom: 1rem;
}

.ai-create-error {
    border-radius: 14px;
}

.ai-create-output {
    min-height: 280px;
    border-radius: 18px;
    border: 1px dashed rgba(15, 23, 42, 0.12);
    background: #f8fafc;
    color: #111827;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 1rem;
    line-height: 1.7;
    font-size: 0.98rem;
}

.ai-create-output:empty::before {
    content: "Your generated content will appear here.";
    color: #94a3b8;
}

.ai-create-result-title {
    color: #111827;
    font-size: 1.05rem;
    font-weight: 800;
}

.ai-create-result-subtitle {
    color: #6b7280;
    font-size: 0.92rem;
}

.ai-create-count,
.ai-create-provider {
    color: #6b7280;
    font-size: 0.9rem;
}

@media (max-width: 991.98px) {
    .ai-create-title {
        max-width: none;
    }
}

@media (max-width: 575.98px) {
    .ai-create-hero,
    .ai-create-panel,
    .ai-create-result {
        border-radius: 18px;
    }

    .ai-create-output {
        min-height: 220px;
    }
}

.history-page {
    width: 100%;
    box-sizing: border-box;
}

.history-hero,
.history-filters,
.history-table-card,
.history-summary,
.history-mobile-card,
.history-modal {
    border-radius: 20px;
    background: #ffffff;
}

.history-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.history-title {
    color: #111827;
    font-size: clamp(1.7rem, 1.25rem + 1.2vw, 2.7rem);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.03em;
    max-width: 18ch;
}

.history-subtitle {
    color: #6b7280;
    font-size: 1rem;
    line-height: 1.75;
    max-width: 56rem;
}

.history-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.history-stat-row:first-child {
    padding-top: 0;
}

.history-stat-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.history-stat-label {
    color: #6b7280;
    font-size: 0.9rem;
}

.history-stat-value {
    color: #111827;
    font-size: 0.98rem;
    font-weight: 800;
    text-align: right;
}

.history-label {
    color: #111827;
    font-weight: 600;
}

.history-input,
.history-select {
    border-radius: 14px;
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: none;
}

.history-input:focus,
.history-select:focus {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.1);
}

.history-button {
    min-height: 44px;
    border-radius: 14px;
    font-weight: 600;
}

.history-toast {
    border-radius: 16px;
    border: 0;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.history-section-title {
    color: #111827;
    font-size: 1.1rem;
    font-weight: 800;
}

.history-section-subtitle {
    color: #6b7280;
    font-size: 0.95rem;
}

.history-table-wrap {
    overflow: visible;
}

.history-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

.history-table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.history-table th:nth-child(1) { width: 12%; }
.history-table th:nth-child(2) { width: 13%; }
.history-table th:nth-child(3) { width: 13%; }
.history-table th:nth-child(4) { width: 12%; }
.history-table th:nth-child(5) { width: 20%; }
.history-table th:nth-child(6) { width: 22%; }
.history-table th:nth-child(7) { width: 8%; }

.history-table td {
    vertical-align: top;
    padding-top: 1rem;
    padding-bottom: 1rem;
    border-color: rgba(15, 23, 42, 0.06);
}

.history-date {
    color: #111827;
    font-weight: 700;
    line-height: 1.4;
}

.history-muted {
    color: #94a3b8;
    font-size: 0.82rem;
    margin-top: 4px;
}

.history-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}

.history-pill-primary {
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
}

.history-pill-purple {
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
}

.history-pill-orange {
    background: rgba(249, 115, 22, 0.1);
    color: #ea580c;
}

.history-pill-success {
    background: rgba(22, 163, 74, 0.1);
    color: #16a34a;
}

.history-pill-outline {
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: #fff;
    color: #475569;
}

.history-snippet {
    color: #475569;
    line-height: 1.6;
    word-break: break-word;
}

.history-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.history-action-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    color: #111827;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.history-action-icon:hover {
    background: #fff;
    color: #111827;
}

.history-mobile-view {
    display: grid;
    gap: 14px;
}

.history-mobile-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    padding: 16px;
}

.history-mobile-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.history-mobile-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.history-mobile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.history-mobile-full {
    grid-column: 1 / -1;
}

.history-mobile-label {
    display: block;
    color: #6b7280;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.history-mobile-value {
    color: #111827;
    font-weight: 700;
}

.history-mobile-dropdown .dropdown-menu {
    border: 0;
    border-radius: 16px;
    padding: 0.5rem;
}

.history-mobile-dropdown .dropdown-item {
    border-radius: 12px;
    min-height: 40px;
}

.history-pagination {
    gap: 6px;
}

.history-pagination .page-link {
    border-radius: 12px !important;
    border: 1px solid rgba(15, 23, 42, 0.08);
    color: #111827;
    box-shadow: none;
}

.history-pagination .page-item.active .page-link {
    background: #2563eb;
    border-color: #2563eb;
}

.history-empty-table {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 280px;
    padding: 2rem 1rem;
}

.history-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    font-size: 1.2rem;
    margin-bottom: 16px;
}

.history-empty-title {
    color: #111827;
    font-size: 1.1rem;
    font-weight: 800;
}

.history-empty-text {
    color: #6b7280;
    max-width: 34rem;
    line-height: 1.7;
}

.history-empty-button {
    min-height: 44px;
    border-radius: 14px;
    font-weight: 600;
}

.history-modal {
    border: 0;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.history-modal-meta {
    color: #6b7280;
    font-size: 0.9rem;
}

.history-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.history-modal-panel {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    background: #f8fafc;
    padding: 16px;
}

.history-modal-panel-wide {
    grid-column: 1 / -1;
}

.history-modal-label {
    color: #111827;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.history-modal-value {
    color: #111827;
    font-weight: 700;
}

.history-modal-pre {
    margin: 0;
    color: #334155;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.75;
    font-size: 0.96rem;
}

.history-modal-response {
    min-height: 200px;
}

.history-delete-modal {
    border-radius: 18px;
}

.templates-page {
    width: 100%;
    box-sizing: border-box;
}

.templates-hero,
.templates-toolbar,
.templates-panel,
.templates-summary,
.templates-card,
.templates-modal {
    border-radius: 20px;
    background: #ffffff;
}

.templates-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.templates-title {
    color: #111827;
    font-size: clamp(1.7rem, 1.25rem + 1.2vw, 2.7rem);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -0.03em;
    max-width: 18ch;
}

.templates-subtitle {
    color: #6b7280;
    font-size: 1rem;
    line-height: 1.75;
    max-width: 58rem;
}

.templates-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.templates-stat-row:first-child {
    padding-top: 0;
}

.templates-stat-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.templates-stat-label {
    color: #6b7280;
    font-size: 0.875rem;
}

.templates-stat-value {
    color: #111827;
    font-size: 0.98rem;
    font-weight: 800;
    text-align: right;
}

.templates-label {
    color: #111827;
    font-weight: 600;
    font-size: 0.875rem;
}

.templates-input,
.templates-select,
.templates-textarea {
    border-radius: 14px;
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: none;
}

.templates-input:focus,
.templates-select:focus,
.templates-textarea:focus {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.1);
}

.templates-button,
.templates-action-btn,
.templates-empty-button {
    min-height: 44px;
    border-radius: 14px;
    font-weight: 600;
}

.templates-toast {
    border-radius: 16px;
    border: 0;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.templates-section-title {
    color: #111827;
    font-size: 1.1rem;
    font-weight: 800;
}

.templates-section-subtitle {
    color: #6b7280;
    font-size: 0.95rem;
}

.templates-counter {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 700;
}

.templates-empty-state {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 300px;
    padding: 2rem 1rem;
}

.templates-empty-illustration {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    font-size: 1.4rem;
    margin-bottom: 16px;
}

.templates-empty-title {
    color: #111827;
    font-size: 1.1rem;
    font-weight: 800;
}

.templates-empty-text {
    color: #6b7280;
    max-width: 34rem;
    line-height: 1.7;
}

.templates-grid {
    display: flex;
}

.templates-card,
.templates-picker-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.templates-card:hover,
.templates-picker-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
}

.templates-card-title,
.templates-picker-title {
    color: #111827;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.35;
    word-break: break-word;
}

.templates-card-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: #64748b;
    font-size: 0.875rem;
}

.templates-dot {
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: #cbd5e1;
}

.templates-card-preview {
    color: #475569;
    line-height: 1.7;
    min-height: 4.8em;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

.templates-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.templates-pill-primary {
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
}

.templates-pill-purple {
    background: rgba(124, 58, 237, 0.08);
    color: #7c3aed;
}

.templates-pill-orange {
    background: rgba(249, 115, 22, 0.1);
    color: #ea580c;
}

.templates-pill-success {
    background: rgba(22, 163, 74, 0.1);
    color: #16a34a;
}

.templates-pill-neutral,
.templates-pill-outline {
    border: 1px solid rgba(15, 23, 42, 0.1);
    background: #fff;
    color: #475569;
}

.templates-favorite-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.templates-favorite-btn.is-active {
    color: #f59e0b;
}

.templates-card-actions {
    display: flex;
    align-items: center;
}

.templates-card-actions .templates-action-btn {
    flex: 1 1 auto;
}

.templates-help {
    color: #6b7280;
    font-size: 0.875rem;
}

.templates-modal {
    border: 0;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.templates-modal-meta {
    color: #6b7280;
    font-size: 0.9rem;
}

.templates-delete-modal {
    border-radius: 18px;
}

.templates-picker-grid {
    min-height: 160px;
}

.templates-picker-card .templates-card-preview {
    min-height: 4.2em;
}

@media (max-width: 991.98px) {
    .templates-title {
        max-width: none;
    }
}

@media (max-width: 575.98px) {
    .templates-hero,
    .templates-toolbar,
    .templates-panel,
    .templates-summary,
    .templates-card,
    .templates-modal {
        border-radius: 18px;
    }
}

@media (max-width: 991.98px) {
    .history-title {
        max-width: none;
    }

    .history-mobile-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .history-modal-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .history-hero,
    .history-filters,
    .history-table-card,
    .history-summary,
    .history-mobile-card,
    .history-modal {
        border-radius: 18px;
    }

    .history-action-icon {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }
}

.history-table-wrap {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    min-width: 0;
    table-layout: auto;
}

.history-table th,
.history-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.history-table th:nth-child(1),
.history-table th:nth-child(2),
.history-table th:nth-child(3),
.history-table th:nth-child(4),
.history-table th:nth-child(5),
.history-table th:nth-child(6),
.history-table th:nth-child(7) {
    width: auto;
}

.history-table td:nth-child(5) .history-snippet {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    max-width: none;
}

.history-table td:nth-child(6) .history-snippet {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    max-width: none;
}

.history-actions {
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.history-action-btn {
    min-width: 0;
}

.history-mobile-card .history-snippet {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: none;
}

.history-mobile-card .history-mobile-full:nth-child(3) .history-snippet {
    -webkit-line-clamp: 2;
}

.history-mobile-card .history-mobile-full:nth-child(4) .history-snippet {
    -webkit-line-clamp: 3;
}

.history-kicker,
.history-pill,
.history-table thead th,
.history-muted,
.history-mobile-label,
.history-modal-label {
    font-size: 0.875rem;
}

.history-page {
    width: 100%;
    box-sizing: border-box;
}

.history-hero,
.history-filters,
.history-table-card,
.history-metrics {
    border-radius: 20px;
    background: #ffffff;
}

.history-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.history-title {
    color: #111827;
    font-size: clamp(1.6rem, 1.2rem + 1vw, 2.5rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.03em;
    max-width: 18ch;
}

.history-subtitle {
    color: #6b7280;
    font-size: 1rem;
    line-height: 1.75;
    max-width: 58rem;
}

.history-metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.history-metric-row:first-child {
    padding-top: 0;
}

.history-metric-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.history-metric-label {
    color: #6b7280;
    font-size: 0.9rem;
}

.history-metric-value {
    color: #111827;
    font-size: 0.98rem;
    font-weight: 800;
    text-align: right;
}

.history-label {
    color: #111827;
    font-weight: 600;
}

.history-input,
.history-select {
    border-radius: 14px;
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: none;
}

.history-input:focus,
.history-select:focus {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.1);
}

.history-button {
    min-height: 44px;
    border-radius: 14px;
    font-weight: 600;
}

.history-section-title {
    color: #111827;
    font-size: 1.1rem;
    font-weight: 800;
}

.history-section-subtitle {
    color: #6b7280;
    font-size: 0.95rem;
}

.history-table-wrap {
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.history-table {
    min-width: 1200px;
}

.history-table thead th {
    background: #f8fafc;
    color: #475569;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.history-table td {
    vertical-align: top;
    padding-top: 1rem;
    padding-bottom: 1rem;
    border-color: rgba(15, 23, 42, 0.06);
}

.history-date {
    color: #111827;
    font-weight: 700;
    line-height: 1.4;
}

.history-muted {
    color: #94a3b8;
    font-size: 0.82rem;
    margin-top: 4px;
}

.history-service {
    color: #111827;
    font-weight: 700;
}

.history-pill {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}

.history-pill-primary {
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
}

.history-pill-neutral {
    background: #f1f5f9;
    color: #475569;
}

.history-snippet {
    color: #475569;
    line-height: 1.6;
    max-width: 360px;
    word-break: break-word;
}

.history-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.history-action-btn {
    min-width: 72px;
    border-radius: 12px;
    font-weight: 600;
}

.history-empty-table {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 280px;
    padding: 2rem 1rem;
}

.history-empty-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: rgba(37, 99, 235, 0.08);
    color: #2563eb;
    font-size: 1.15rem;
    margin-bottom: 16px;
}

.history-empty-title {
    color: #111827;
    font-size: 1.05rem;
    font-weight: 800;
}

.history-empty-text {
    color: #6b7280;
    max-width: 34rem;
    line-height: 1.7;
}

.history-modal {
    border-radius: 20px;
    border: 0;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.history-modal-meta {
    color: #6b7280;
    font-size: 0.9rem;
}

.history-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.history-modal-panel {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    background: #f8fafc;
    padding: 16px;
}

.history-modal-panel-wide {
    grid-column: 1 / -1;
}

.history-modal-label {
    color: #111827;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.history-modal-pre {
    margin: 0;
    color: #334155;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
    font-size: 0.96rem;
}

.history-modal-response {
    min-height: 180px;
}

@media (max-width: 991.98px) {
    .history-title {
        max-width: none;
    }

    .history-snippet {
        max-width: 260px;
    }
}

@media (max-width: 767.98px) {
    .history-modal-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .history-hero,
    .history-filters,
    .history-table-card,
    .history-metrics {
        border-radius: 18px;
    }

    .history-actions {
        justify-content: flex-start;
    }

    .history-action-btn {
        flex: 1 1 auto;
    }
}
