:root {
    --color-primary: #0e7afe;
    --color-ink-50: #f9fbff;
    --color-ink-900: #161a22;
    --color-gray-50: #f9fafb;
    --color-gray-100: #f3f4f6;
    --color-gray-200: #e5e7eb;
    --color-gray-300: #d1d5db;
    --color-gray-500: #6b7280;
    --color-gray-600: #4b5563;
    --color-gray-700: #374151;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    color: var(--color-ink-900);
    background: var(--color-ink-50);
}

img {
    max-width: 100%;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

button:focus {
    outline: none;
}

button:focus-visible {
    box-shadow: 0 0 0 3px rgba(14, 122, 254, .24);
}

#emailTagsContainer,
#searchTagsContainer,
#customEmailTagsContainer {
    cursor: text;
}

.h-full { height: 100%; }
.h-10 { height: 2.5rem !important; }
.h-\[260px\] { height: 260px; }
.min-h-screen { min-height: 100vh; }
.min-h-\[50px\] { min-height: 50px; }
.w-full { width: 100%; }
.w-10 { width: 2.5rem !important; }
.w-44 { width: 11rem; }
.w-56 { width: 14rem; }
.min-w-full { min-width: 100%; }
.min-w-\[160px\] { min-width: 160px; }
.max-w-md { max-width: 28rem; }
.max-w-xl { max-width: 36rem; }
.max-h-60 { max-height: 15rem; }

.block { display: block; }
.hidden { display: none; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: minmax(0, 1fr); }
.flex-1 { flex: 1 1 0%; min-width: 12rem; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.object-contain { object-fit: contain; }

.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }
.space-y-6 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.5rem; }
.space-y-8 > :not([hidden]) ~ :not([hidden]) { margin-top: 2rem; }

.m-0 { margin: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-1 { margin-top: .25rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.me-2 { margin-right: .5rem; }
.ms-2 { margin-left: .5rem; }

.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.px-2 { padding-left: .5rem; padding-right: .5rem; }
.px-3 { padding-left: .75rem; padding-right: .75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.py-1 { padding-top: .25rem; padding-bottom: .25rem; }
.py-1\.5 { padding-top: .375rem; padding-bottom: .375rem; }
.py-2 { padding-top: .5rem; padding-bottom: .5rem; }
.py-3 { padding-top: .75rem; padding-bottom: .75rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }

.fixed { position: fixed; }
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }

.overflow-y-auto { overflow-y: auto; }
.cursor-pointer { cursor: pointer; }

.rounded { border-radius: .25rem; }
.rounded-lg { border-radius: .5rem !important; }
.rounded-2xl { border-radius: 1rem !important; }
.border { border: 1px solid var(--color-gray-200) !important; }
.border-0 { border: 0 !important; }
.border-t { border-top: 1px solid var(--color-gray-200) !important; }
.border-b { border-bottom: 1px solid var(--color-gray-200) !important; }
.border-primary { border-color: var(--color-primary) !important; }
.border-gray-200 { border-color: var(--color-gray-200) !important; }
.border-gray-300 { border-color: var(--color-gray-300) !important; }
.border-green-600 { border-color: #16a34a !important; }

.bg-transparent { background-color: transparent !important; }
.bg-white { background-color: #fff !important; }
.bg-white\/70 { background-color: rgba(255, 255, 255, .7) !important; }
.bg-white\/80 { background-color: rgba(255, 255, 255, .8) !important; }
.bg-gray-50 { background-color: var(--color-gray-50) !important; }
.bg-primary { background-color: var(--color-primary) !important; }
.bg-green-600 { background-color: #16a34a !important; }
.bg-red-600 { background-color: #dc2626 !important; }
.bg-yellow-500 { background-color: #eab308 !important; }
.bg-ink-50 { background-color: var(--color-ink-50) !important; }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-xs { font-size: .75rem; line-height: 1rem; }
.text-sm { font-size: .875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.font-semibold { font-weight: 600; }
.text-white { color: #fff !important; }
.text-primary { color: var(--color-primary) !important; }
.text-green-700 { color: #15803d !important; }
.text-gray-500 { color: var(--color-gray-500) !important; }
.text-gray-600 { color: var(--color-gray-600) !important; }
.text-gray-700 { color: var(--color-gray-700) !important; }
.text-ink-900 { color: var(--color-ink-900) !important; }

.outline-none { outline: 2px solid transparent; outline-offset: 2px; }
.shadow-soft { box-shadow: 0 8px 30px rgba(2, 12, 27, .06); }
.backdrop-blur { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.transition { transition: color .15s ease, background-color .15s ease, border-color .15s ease, filter .15s ease; }

.hover\:brightness-110:hover { filter: brightness(1.1); }
.hover\:bg-gray-50:hover { background-color: var(--color-gray-50) !important; }
.hover\:bg-primary:hover { background-color: var(--color-primary) !important; }
.hover\:bg-green-600:hover { background-color: #16a34a !important; }
.hover\:text-white:hover { color: #fff !important; }

.focus\:ring-0:focus { box-shadow: none !important; }
.focus\:ring-2:focus { box-shadow: 0 0 0 3px rgba(14, 122, 254, .22) !important; }
.focus\:ring-primary:focus { border-color: var(--color-primary) !important; }

.file\:mr-4::file-selector-button { margin-right: 1rem; }
.file\:py-2::file-selector-button { padding-top: .5rem; padding-bottom: .5rem; }
.file\:px-4::file-selector-button { padding-left: 1rem; padding-right: 1rem; }
.file\:rounded-lg::file-selector-button { border-radius: .5rem; }
.file\:border-0::file-selector-button { border: 0; }
.file\:text-sm::file-selector-button { font-size: .875rem; line-height: 1.25rem; }
.file\:bg-primary::file-selector-button { background-color: var(--color-primary); }
.file\:text-white::file-selector-button { color: #fff; }

@media (min-width: 640px) {
    .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
    .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .sm\:col-span-2 { grid-column: span 2 / span 2; }
}

@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:col-span-2 { grid-column: span 2 / span 2; }
    .md\:inline-flex { display: inline-flex; }
}

@media (min-width: 1024px) {
    .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
}

/* Admin shell */
.admin-shell {
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
    background:
        linear-gradient(180deg, #f7f9fd 0%, #f3f6fb 100%);
    transition: grid-template-columns .18s ease;
}

.admin-shell.sidebar-collapsed {
    grid-template-columns: 84px minmax(0, 1fr);
}

.admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    background: #ffffff;
    border-right: 1px solid #e3e8f2;
    box-shadow: 1px 0 0 rgba(15, 23, 42, .02);
    transition: padding .18s ease;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px 22px;
    border-bottom: 1px solid #edf1f7;
}

.admin-brand-text {
    min-width: 0;
}

.admin-brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: cover;
}

.admin-brand-name {
    font-size: 18px;
    line-height: 1.2;
    font-weight: 700;
    color: #101828;
}

.admin-brand-subtitle {
    margin-top: 2px;
    font-size: 12px;
    color: #667085;
}

.admin-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 34px;
    margin-top: 12px;
    padding: 0 10px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #edf1f7;
}

.admin-sidebar-toggle:hover {
    background: #f3f7ff;
    border-color: #d8e5fb;
}

.admin-toggle-label {
    color: #667085;
    font-size: 12px;
    font-weight: 700;
}

.admin-toggle-icon {
    display: grid;
    gap: 3px;
    width: 18px;
}

.admin-toggle-line {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #667085;
}

.admin-nav {
    display: grid;
    gap: 6px;
    padding-top: 12px;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 8px;
    background: transparent;
    color: #475467;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.admin-nav-item:hover {
    background: #f3f7ff;
    color: #0e5ed7;
}

.admin-nav-item.is-active {
    background: #eaf3ff;
    color: #0b63ce;
    box-shadow: inset 3px 0 0 #0e7afe;
}

.admin-nav-icon {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #f2f4f7;
    color: #667085;
    font-size: 11px;
    font-weight: 700;
    flex: 0 0 auto;
}

.admin-nav-label,
.admin-logout-label,
.admin-brand-text {
    transition: opacity .12s ease;
}

.admin-nav-item.is-active .admin-nav-icon {
    background: #0e7afe;
    color: #ffffff;
}

.admin-sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #edf1f7;
}

.admin-logout-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 40px;
    border-radius: 8px;
    background: #fff1f0;
    color: #b42318;
    font-size: 14px;
    font-weight: 700;
}

.admin-logout-button:hover {
    background: #fee4e2;
}

.admin-logout-icon {
    display: none;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #fee4e2;
    font-size: 11px;
    font-weight: 800;
}

.admin-shell.sidebar-collapsed .admin-sidebar {
    padding-left: 12px;
    padding-right: 12px;
}

.admin-shell.sidebar-collapsed .admin-brand {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.admin-shell.sidebar-collapsed .admin-brand-text,
.admin-shell.sidebar-collapsed .admin-nav-label,
.admin-shell.sidebar-collapsed .admin-logout-label {
    display: none;
}

.admin-shell.sidebar-collapsed .admin-sidebar-toggle,
.admin-shell.sidebar-collapsed .admin-nav-item,
.admin-shell.sidebar-collapsed .admin-logout-button {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.admin-shell.sidebar-collapsed .admin-toggle-label {
    display: none;
}

.admin-shell.sidebar-collapsed .admin-nav-item {
    gap: 0;
}

.admin-shell.sidebar-collapsed .admin-nav-item.is-active {
    box-shadow: inset 0 0 0 1px #0e7afe;
}

.admin-shell.sidebar-collapsed .admin-logout-icon {
    display: grid;
}

.admin-workspace {
    min-width: 0;
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 25;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    min-height: 84px;
    padding: 18px 28px;
    background: rgba(247, 249, 253, .92);
    border-bottom: 1px solid #e3e8f2;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.admin-eyebrow {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
    color: #667085;
}

.admin-page-title {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 750;
    color: #101828;
}

.admin-page-subtitle {
    max-width: 520px;
    margin: 0;
    color: #667085;
    font-size: 14px;
    text-align: right;
}

.admin-content {
    display: block;
    width: 100%;
    padding: 24px 28px 36px;
}

#dashboardContainer,
#orderSection,
#accountsContainer,
#sheetOrdersContainer {
    width: 100%;
    padding: 0 !important;
}

#orderSection {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
}

#orderSection > * {
    margin-top: 0 !important;
}

#orderSection > :nth-child(3) {
    grid-column: 1 / -1;
}

#dashboardContainer .bg-white,
#orderSection > .bg-white,
#accountsContainer > .bg-white,
#sheetOrdersContainer > .bg-white {
    display: flex;
    flex-direction: column;
    border: 1px solid #e3e8f2;
    border-radius: 8px !important;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 26px rgba(16, 24, 40, .06);
}

#uploadForm,
#renewalUploadForm {
    display: flex !important;
    flex-direction: column;
    flex: 1;
}

#uploadForm .md\:col-span-2,
#renewalUploadForm .md\:col-span-2 {
    margin-top: auto;
}

#dashboardContainer .bg-white:hover,
#orderSection > .bg-white:hover,
#accountsContainer > .bg-white:hover,
#sheetOrdersContainer > .bg-white:hover {
    border-color: #d5ddec;
}

#orderSection > .bg-white > h5,
#accountsContainer h5,
#sheetOrdersContainer h5,
#dashboardContainer h5 {
    margin-bottom: 4px !important;
    color: #101828;
    text-align: left !important;
    font-size: 16px;
    line-height: 1.35;
}

#orderSection > .bg-white > p,
#sheetOrdersContainer > .bg-white > p {
    text-align: left !important;
    color: #667085 !important;
}

#dashboardContainer .grid:first-child .bg-white {
    position: relative;
    overflow: hidden;
}

#dashboardContainer .grid:first-child .bg-white::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: #0e7afe;
}

label {
    color: #344054;
    font-weight: 650;
}

input,
textarea,
select,
.form-control,
#emailTagsContainer,
#searchTagsContainer,
#customEmailTagsContainer {
    min-height: 42px;
    border-radius: 8px !important;
    border-color: #d0d5dd !important;
    color: #101828;
}

input::placeholder,
textarea::placeholder {
    color: #98a2b3;
}

input:hover,
textarea:hover,
select:hover,
.form-control:hover,
#emailTagsContainer:hover,
#searchTagsContainer:hover,
#customEmailTagsContainer:hover {
    border-color: #98a2b3 !important;
}

#emailTagsContainer:focus-within,
#searchTagsContainer:focus-within,
#customEmailTagsContainer:focus-within {
    border-color: #0e7afe !important;
    box-shadow: 0 0 0 3px rgba(14, 122, 254, .16);
}

button.bg-primary,
button.bg-green-600,
button.bg-red-600,
button.bg-yellow-500,
#searchButton,
#uploadButton,
#renewalUploadButton,
#sendNotificationButton,
#sendCustomEmailButton,
#sheetSearchButton,
#saveButton,
#saveRenewalButton,
#saveManualOrderButton,
#saveAllButton,
#bulkStatusUpdateButton {
    min-height: 42px;
    border-radius: 8px !important;
    font-weight: 700;
}

#downloadCSVButton,
#manualAddButton,
#revealToggle {
    min-height: 38px;
    border-radius: 8px !important;
    font-weight: 650;
}

.k-table-wrap {
    border-color: #e3e8f2;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}

#orderTable,
#resultsTable,
#renewalTable,
#accountsTable,
#sheetResultsTable {
    font-size: 13px;
}

#orderTable thead th,
#resultsTable thead th,
#renewalTable thead th,
#accountsTable thead th,
#sheetResultsTable thead th {
    background: #f8fafc;
    color: #475467;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
}

#orderTable tbody td,
#resultsTable tbody td,
#renewalTable tbody td,
#accountsTable tbody td,
#sheetResultsTable tbody td {
    color: #344054;
}

#resultsFilterBar {
    padding: 12px;
    border: 1px solid #e3e8f2;
    border-radius: 8px;
    background: #f8fafc;
}

#resultsFilterBar label {
    color: #667085;
}

.modal-content {
    border: 1px solid #e3e8f2;
    border-radius: 8px !important;
}

@media (max-width: 1023px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        position: static;
        height: auto;
        padding: 14px 16px;
        border-right: 0;
        border-bottom: 1px solid #e3e8f2;
    }

    .admin-brand {
        padding-bottom: 12px;
    }

    .admin-nav {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
        padding-top: 12px;
    }

    .admin-nav-item {
        justify-content: center;
    }

    .admin-sidebar-footer {
        padding-top: 12px;
        border-top: 0;
    }

    .admin-sidebar-toggle {
        display: none;
    }

    .admin-shell.sidebar-collapsed .admin-brand-text,
    .admin-shell.sidebar-collapsed .admin-nav-label,
    .admin-shell.sidebar-collapsed .admin-logout-label {
        display: block;
    }

    .admin-shell.sidebar-collapsed .admin-nav-item,
    .admin-shell.sidebar-collapsed .admin-logout-button {
        justify-content: center;
        padding-left: 12px;
        padding-right: 12px;
    }

    .admin-shell.sidebar-collapsed .admin-nav-item {
        gap: 10px;
    }

    .admin-shell.sidebar-collapsed .admin-logout-icon {
        display: none;
    }

    .admin-topbar {
        position: static;
        align-items: flex-start;
        flex-direction: column;
        min-height: 0;
        padding: 18px 20px;
    }

    .admin-page-subtitle {
        text-align: left;
    }

    .admin-content {
        padding: 18px 20px 28px;
    }

    #orderSection {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .admin-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-nav-item {
        justify-content: flex-start;
    }

    .admin-content {
        padding: 14px;
    }

    .admin-page-title {
        font-size: 21px;
    }
}
