/* =========================================================
   TOOLBOX - GLOBAL CSS
========================================================= */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: #f7f8fc;
    color: #172033;
    font: 14px Inter, Arial, sans-serif;
}

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

button {
    cursor: pointer;
}

a {
    color: inherit;
}

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


/* =========================================================
   SIDEBAR
========================================================= */

.sidebar {
    width: 252px;
    position: fixed;
    inset: 0 auto 0 0;
    background: #fff;
    border-right: 1px solid #e8ecf2;
    padding: 22px 14px;
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 0 10px 28px;
}

.logo {
    width: 36px;
    height: 36px;
    background: var(--theme-primary, #2563eb);
    color: white;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 18px;
}

.brand b,
.brand small,
.profile b,
.profile small {
    display: block;
}

.brand small,
.profile small {
    font-size: 10px;
    color: #98a2b3;
    margin-top: 2px;
}

.brand b {
    font-size: 17px;
}

nav {
    flex: 1;
}

.sidebar > nav {
    min-height: 0;
    overflow-y: auto;
}

nav label {
    display: block;
    font-size: 10px;
    color: #9aa3b2;
    font-weight: 700;
    letter-spacing: .1em;
    padding: 0 12px 8px;
}

nav label:nth-of-type(2) {
    margin-top: 25px;
}

nav > a {
    display: flex;
    gap: 12px;
    align-items: center;
    text-decoration: none;
    color: #667085;
    height: 42px;
    padding: 0 13px;
    border-radius: 9px;
    margin: 4px 0;
    font-weight: 500;
}

nav > a:hover {
    background: #f6f8fb;
}

nav > a.active {
    background: var(--theme-soft, #eef4ff);
    color: var(--theme-primary, #2563eb);
    font-weight: 600;
}

.nav-icon {
    width: 18px;
    text-align: center;
    font-size: 14px;
}


/* =========================================================
   TOOLS DROPDOWN
========================================================= */

.tools-dropdown {
    width: 100%;
    margin: 4px 0;
}

.tools-dropdown summary {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 42px;
    padding: 0 13px;
    cursor: pointer;
    list-style: none;
    border-radius: 9px;
    color: #667085;
    font-weight: 500;
}

.tools-dropdown summary::-webkit-details-marker {
    display: none;
}

.tools-dropdown summary:hover {
    background: #f6f8fb;
}

.tools-dropdown summary i {
    margin-left: auto;
    font-style: normal;
    transition: transform .2s ease;
}

.tools-dropdown[open] summary i {
    transform: rotate(90deg);
}

.tool-submenu {
    margin: 2px 0 8px 30px;
    padding-left: 10px;
    border-left: 1px solid #e7e9ef;
}

.tool-submenu a {
    display: block;
    padding: 8px 10px;
    color: #8b95a5;
    font-size: 11px;
    text-decoration: none;
    border-radius: 6px;
}

.tool-submenu a:hover {
    color: var(--theme-primary, #2563eb);
    background: #f5f7fb;
}

.tool-submenu a.active {
    color: var(--theme-primary, #2563eb);
    background: var(--theme-soft, #f1f5ff);
    font-weight: 600;
}


/* =========================================================
   PROFILE
========================================================= */

.profile {
    border-top: 1px solid #edf0f5;
    padding: 14px 4px 0;
    display: flex;
    align-items: center;
    gap: 9px;
}

.profile > div:nth-child(2) {
    flex: 1;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--theme-soft, #e8eefc);
    color: var(--theme-primary, #3159a8);
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
}

.profile i {
    font-style: normal;
    color: #98a2b3;
}

.logout {
    text-decoration: none;
    font-size: 17px;
}


/* =========================================================
   MAIN
========================================================= */

main {
    margin-left: 252px;
    flex: 1;
    min-width: 0;
}


/* =========================================================
   HEADER
========================================================= */

header {
    height: 70px;
    background: #fff;
    border-bottom: 1px solid #e8ecf2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.search {
    width: 360px;
    height: 38px;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 10px;
    color: #98a2b3;
}

.search input {
    border: 0;
    outline: 0;
    flex: 1;
    font: inherit;
    font-size: 12px;
    background: transparent;
}

.search kbd {
    font-size: 9px;
    border: 1px solid #e1e6ed;
    border-radius: 5px;
    padding: 3px 6px;
}

.actions {
    display: flex;
    gap: 9px;
    align-items: center;
}

.actions button {
    width: 35px;
    height: 35px;
    border: 1px solid #e6eaf0;
    background: white;
    border-radius: 50%;
    color: #667085;
}

.mobile {
    display: none;
}


/* =========================================================
   CONTENT
========================================================= */

.content {
    max-width: 1500px;
    margin: auto;
    padding: 30px 32px 45px;
}


/* =========================================================
   WELCOME
========================================================= */

.welcome {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 25px;
}

.welcome small {
    font-size: 9px;
    color: #98a2b3;
    font-weight: 700;
    letter-spacing: .12em;
}

.welcome h1 {
    font-size: 25px;
    letter-spacing: -.7px;
    margin: 7px 0;
}

.welcome p,
.head p {
    color: #8b95a5;
    font-size: 11px;
    margin: 0;
}


/* =========================================================
   BUTTONS
========================================================= */

.primary {
    width: auto;
    background: var(--theme-primary, #2563eb);
    color: white;
    border: 0;
    border-radius: 7px;
    padding: 10px 15px;
    font-weight: 600;
    cursor: pointer;
}

.primary:hover {
    background: var(--theme-hover, #1d4ed8);
}


/* =========================================================
   STATS
========================================================= */

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 18px;
}

.stats article,
.card {
    background: #fff;
    border: 1px solid #e7e9ef;
    border-radius: 12px;
    padding: 18px;
}

.stats article {
    padding: 17px;
}

.stats article > div {
    font-size: 11px;
    color: #7b8494;
    display: flex;
    justify-content: space-between;
}

.stats em {
    font-style: normal;
    background: var(--theme-soft, #eef4ff);
    color: var(--theme-primary, #2563eb);
    padding: 7px;
    border-radius: 8px;
}

.stats strong {
    display: block;
    font-size: 24px;
    margin: 14px 0 7px;
}


.stats small {
    color: #98a2b3;
    font-size: 10px;
}

.stats small b {
    color: #16a05d;
}


/* =========================================================
   ROW / CARDS
========================================================= */

.row {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}

.card {
    padding: 20px;
}

.head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.head h2 {
    font-size: 13px;
    margin: 0 0 5px;
}

.head a {
    font-size: 10px;
    color: var(--theme-primary, #2563eb);
    font-weight: 600;
}

.head select {
    font-size: 10px;
    border: 1px solid #e4e8ee;
    border-radius: 7px;
    padding: 7px;
    color: #667085;
    background: white;
}


/* =========================================================
   CHART
========================================================= */

.chart {
    height: 245px;
    position: relative;
    margin-top: 15px;
}

.chart .lines {
    position: absolute;
    inset: 10px 0 32px;
    background:
            repeating-linear-gradient(
                    to bottom,
                    transparent 0,
                    transparent 46px,
                    #edf0f4 47px
            );
}

svg {
    position: absolute;
    left: 0;
    right: 0;
    top: 8px;
    width: 100%;
    height: 198px;
}

.area {
    fill: var(--theme-primary, #2563eb);
    opacity: .1;
}

.line {
    fill: none;
    stroke: var(--theme-primary, #3b82f6);
    stroke-width: 3;
}

.dates {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: space-between;
    color: #9ca5b2;
    font-size: 9px;
}


/* =========================================================
   ACTIVITY
========================================================= */

.activity {
    margin-top: 13px;
}

.activity > div {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f2f6;
}

.activity > div:last-child {
    border: 0;
}

.activity i,
.tools i {
    width: 31px;
    height: 31px;
    border-radius: 8px;
    background: var(--theme-soft, #eef4ff);
    color: var(--theme-primary, #2563eb);
    display: grid;
    place-items: center;
    font-style: normal;
}

.activity span {
    flex: 1;
    font-size: 9px;
    color: #9aa3b1;
}

.activity b {
    display: block;
    color: #172033;
    font-size: 11px;
    margin-bottom: 3px;
}

.activity time {
    font-size: 9px;
    color: #a0a8b6;
}


/* =========================================================
   DASHBOARD TOOLS
========================================================= */

.tools {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.tools button {
    display: flex;
    align-items: center;
    gap: 9px;
    text-align: left;
    background: white;
    border: 1px solid #edf0f4;
    border-radius: 9px;
    padding: 12px;
    cursor: pointer;
}

.tools span {
    flex: 1;
}

.tools b,
.tools small {
    display: block;
}

.tools b {
    font-size: 10px;
}

.tools small {
    font-size: 8px;
    color: #9aa3b1;
    margin-top: 3px;
}


/* =========================================================
   USAGE
========================================================= */

.usage {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
}

.ring {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    background:
            conic-gradient(
                    var(--theme-primary, #2563eb) 0 24.8%,
                    #edf1f6 24.8%
            );
    display: grid;
    place-content: center;
    text-align: center;
}

.ring b,
.ring small {
    display: block;
}

.ring b {
    font-size: 14px;
}

.ring small {
    font-size: 8px;
    color: #9aa3b1;
}

.usage p {
    font-size: 9px;
    color: #9aa3b1;
    margin: 4px 0;
}

.progress {
    height: 6px;
    background: #edf1f5;
    border-radius: 9px;
    overflow: hidden;
}

.progress span {
    display: block;
    width: 24.8%;
    height: 100%;
    background: var(--theme-primary, #2563eb);
}



/* =========================================================
   RECENT REQUESTS TABLE
========================================================= */

.tablecard {
    margin-top: 18px;
}

.tablecard .cardhead {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.tablecard .cardhead h2 {
    font-size: 13px;
    margin: 0 0 5px;
    color: #172033;
}

.tablecard .cardhead p {
    margin: 0;
    color: #8b95a5;
    font-size: 11px;
}

.tablecard .filter {
    width: 150px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #e3e8ef;
    border-radius: 7px;
    outline: none;
    background: #fff;
    color: #172033;
    font: 11px Inter, Arial, sans-serif;
}

.tablecard .filter::placeholder {
    color: #a0a8b6;
}

.tablecard .filter:focus {
    border-color: var(--theme-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(var(--theme-rgb, 37, 99, 235), .08);
}

.tablecard .scroll {
    width: 100%;
    overflow-x: auto;
}

.tablecard table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

.tablecard th {
    padding: 11px 12px;
    text-align: left;
    background: #f8f9fb;
    color: #8b95a5;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid #edf0f4;
}

.tablecard td {
    padding: 13px 12px;
    color: #667085;
    font-size: 10px;
    border-bottom: 1px solid #f0f2f6;
    white-space: nowrap;
}

.tablecard tbody tr:last-child td {
    border-bottom: 0;
}

.tablecard tbody tr:hover {
    background: #fafbfc;
}

.tablecard td:first-child {
    color: #172033;
    font-weight: 600;
}

.tablecard td:nth-child(2) {
    color: #7b8494;
}

.tablecard td:last-child {
    color: #98a2b3;
}

.tablecard mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 20px;
    background: #eaf8f0;
    color: #16a05d;
    font-size: 9px;
    font-weight: 600;
}

.tablecard mark.wait {
    background: #fff7e6;
    color: #c88719;
}

.tablecard mark.fail {
    background: #fff0f0;
    color: #dc4c4c;
}


/* =========================================================
   404
========================================================= */

.error-page {
    min-height: 65vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.error-icon {
    font-size: 90px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -6px;
    color: var(--theme-primary, #2563eb);
    margin-bottom: 20px;
}

.error-page h1 {
    margin: 0 0 8px;
    font-size: 24px;
    color: #172033;
}

.error-page p {
    max-width: 420px;
    margin: 0;
    color: #8b95a5;
    font-size: 12px;
    line-height: 1.7;
}

.error-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
}

.error-actions a {
    text-decoration: none;
    min-width: 130px;
    text-align: center;
}

.error-actions .primary {
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.error-actions .secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 15px;
    border: 1px solid #e3e8ef;
    border-radius: 7px;
    color: #667085;
    background: #fff;
    font-size: 11px;
    font-weight: 600;
}

.error-actions .secondary:hover {
    background: #f8f9fb;
}


/* =========================================================
   SETTINGS
========================================================= */

.settings-page {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.settings-header {
    margin-bottom: 20px;
}

.settings-header h1 {
    margin: 0 0 6px;
    font-size: 25px;
    font-weight: 700;
    letter-spacing: -.7px;
    color: #172033;
}

.settings-header p {
    margin: 0;
    color: #8b95a5;
    font-size: 11px;
}


/* Alerts */

.settings-alert {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 13px;
    margin-bottom: 15px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
}

.settings-alert span {
    width: 21px;
    height: 21px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 10px;
}

.settings-alert.success {
    background: #eefaf3;
    border: 1px solid #d4f1df;
    color: #15935a;
}

.settings-alert.success span {
    background: #dff6e9;
    color: #15935a;
}

.settings-alert.error {
    background: #fff1f1;
    border: 1px solid #f7d6d6;
    color: #d94b4b;
}

.settings-alert.error span {
    background: #ffe0e0;
    color: #d94b4b;
}


/* Cards */

.settings-card {
    background: #fff;
    border: 1px solid #e7e9ef;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
}

.settings-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 17px 18px;
    border-bottom: 1px solid #edf0f4;
}

.settings-card-head h2 {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 700;
    color: #172033;
}

.settings-card-head p {
    margin: 0;
    font-size: 10px;
    color: #8b95a5;
}


/* Status */

.settings-status {
    padding: 5px 9px;
    border-radius: 20px;
    background: #f1f4f8;
    color: #7b8494;
    font-size: 9px;
    font-weight: 600;
    white-space: nowrap;
}


/* Forms */

.settings-card form {
    padding: 18px;
}

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

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-field.full {
    grid-column: 1 / -1;
}

.settings-field label,
.api-key-wrapper label {
    font-size: 10px;
    font-weight: 600;
    color: #667085;
}

.settings-field input,
.api-key-row input {
    width: 100%;
    height: 38px;
    padding: 0 11px;
    border: 1px solid #e3e8ef;
    border-radius: 7px;
    outline: none;
    background: #fff;
    color: #172033;
    font: 11px Inter, Arial, sans-serif;
}

.settings-field input:focus,
.api-key-row input:focus {
    border-color: var(--theme-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(var(--theme-rgb, 37, 99, 235), .07);
}


/* Settings buttons */

.settings-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 17px;
}

.settings-btn {
    min-height: 36px;
    padding: 0 14px;
    border-radius: 7px;
    border: 0;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
}

.settings-btn.primary {
    width: auto;
    background: var(--theme-primary, #2563eb);
    color: #fff;
}

.settings-btn.secondary {
    background: #f7f8fa;
    border: 1px solid #e1e5eb;
    color: #667085;
}


/* API */

.api-box {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 18px;
}

.api-key-wrapper {
    flex: 1;
}

.api-key-wrapper label {
    display: block;
    margin-bottom: 6px;
}

.api-key-row {
    display: flex;
    gap: 7px;
}

.api-key-row input {
    flex: 1;
    font-family: monospace;
    background: #f8f9fb;
}

.api-warning {
    margin: 0 18px 18px;
    padding: 10px 12px;
    border-radius: 7px;
    background: #fff8e8;
    border: 1px solid #f2dfaa;
    color: #92701b;
    font-size: 9px;
    line-height: 1.6;
}


/* =========================================================
   EXTRACTOR TOOLS
========================================================= */

.tool-page {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.extractor-card {
    background: #fff;
    border: 1px solid #e7e9ef;
    border-radius: 12px;
    padding: 22px;
}

.extractor-header {
    margin-bottom: 24px;
}

.extractor-header h2 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 700;
    color: #172033;
}

.extractor-header p {
    margin: 0;
    color: #8b95a5;
    font-size: 11px;
    line-height: 1.5;
}

.extractor-form {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.extractor-label {
    padding-top: 10px;
}

.extractor-label label {
    display: block;
    color: #667085;
    font-size: 11px;
    font-weight: 600;
}

.extractor-input {
    min-width: 0;
}

.extractor-input textarea {
    display: block;
    width: 100%;
    height: 275px;
    min-height: 200px;
    padding: 12px 13px;
    resize: vertical;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    outline: none;
    background: #fff;
    color: #172033;
    font: 12px/1.6 Inter, Arial, sans-serif;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.extractor-input textarea::placeholder {
    color: #a0a8b6;
}

.extractor-input textarea:focus {
    border-color: var(--theme-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(var(--theme-rgb, 37, 99, 235), .08);
}


/* Extractor actions */

.extractor-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.extractor-actions button {
    width: auto;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 7px;
    border: 0;
    font: 600 10px Inter, Arial, sans-serif;
    cursor: pointer;
}

.extractor-actions .extract-btn {
    background: var(--theme-primary, #2563eb);
    color: #fff;
}

.extractor-actions .extract-btn:hover {
    background: var(--theme-hover, #1d4ed8);
}

.extractor-actions .clear-btn {
    background: #fff;
    color: #667085;
    border: 1px solid #e1e5eb;
}

.extractor-actions .clear-btn:hover {
    background: #f7f8fa;
}


/* File */

.extractor-file {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 13px;
    border-radius: 7px;
    border: 1px solid #e1e5eb;
    background: #f8f9fb;
    color: #667085;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
}

.extractor-file:hover {
    background: #f1f4f8;
}

.extractor-file input {
    display: none;
}


/* Info */

.extractor-info {
    margin-top: 9px;
    color: #98a2b3;
    font-size: 9px;
}


/* Result */

.extractor-result {
    margin-top: 18px;
}

.extractor-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 12px;
}

.extractor-result-head h3 {
    margin: 0 0 4px;
    color: #172033;
    font-size: 13px;
}

.extractor-result-head p {
    margin: 0;
    color: #8b95a5;
    font-size: 10px;
}

.extractor-result-head strong {
    color: var(--theme-primary, #2563eb);
}

.extractor-result-actions {
    display: flex;
    gap: 7px;
}

.extractor-result-actions button {
    min-height: 32px;
    padding: 0 11px;
    border-radius: 7px;
    border: 1px solid #e1e5eb;
    background: #fff;
    color: #667085;
    font: 600 9px Inter, Arial, sans-serif;
    cursor: pointer;
}

.extractor-result-actions button:hover {
    background: #f7f8fa;
}

.extractor-result textarea {
    display: block;
    width: 100%;
    height: 250px;
    padding: 12px;
    resize: vertical;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    background: #f9fafb;
    color: #172033;
    outline: none;
    font: 11px/1.7 Inter, Arial, sans-serif;
}

.extractor-result textarea::placeholder {
    color: #a0a8b6;
}


/* =========================================================
   DARK MODE
========================================================= */

body.dark {
    background: #10141d;
    color: #eef2f8;
}

body.dark .sidebar,
body.dark header,
body.dark .stats article,
body.dark .card,
body.dark .tools button,
body.dark .actions button {
    background: #171c27;
    border-color: #293241;
}

body.dark .brand b,
body.dark .welcome h1,
body.dark .head h2,
body.dark .stats strong {
    color: #eef2f8;
}

body.dark nav > a,
body.dark .tools-dropdown summary {
    color: #aeb7c5;
}

body.dark nav > a:hover,
body.dark .tools-dropdown summary:hover {
    background: #1d2430;
}

body.dark nav > a.active {
    background: #172554;
    color: #60a5fa;
}

body.dark .tool-submenu {
    border-color: #293241;
}

body.dark .tool-submenu a {
    color: #8f9aaa;
}

body.dark .tool-submenu a:hover,
body.dark .tool-submenu a.active {
    color: #60a5fa;
    background: #172554;
}

body.dark .activity b {
    color: #eef2f8;
}

body.dark .search {
    border-color: #293241;
    background: #141923;
}

body.dark .search input {
    color: #eef2f8;
}

body.dark .search kbd {
    border-color: #293241;
}


body.dark .ring {
    background:
            conic-gradient(
                    #4b8df8 0 24.8%,
                    #293241 24.8%
            );
}

body.dark .tablecard .cardhead h2 {
    color: #eef2f8;
}

body.dark .tablecard .filter {
    background: #171c27;
    border-color: #293241;
    color: #eef2f8;
}

body.dark .tablecard th {
    background: #141923;
    border-color: #293241;
    color: #8f9aaa;
}

body.dark .tablecard td {
    border-color: #252d3a;
    color: #aeb7c5;
}

body.dark .tablecard td:first-child {
    color: #eef2f8;
}

body.dark .tablecard tbody tr:hover {
    background: #1b212d;
}

body.dark .tablecard mark {
    background: #123522;
    color: #55c98a;
}

body.dark .tablecard mark.wait {
    background: #3a2d12;
    color: #e4ad45;
}

body.dark .tablecard mark.fail {
    background: #3b1919;
    color: #f27a7a;
}


/* Settings dark */

body.dark .settings-header h1 {
    color: #eef2f8;
}

body.dark .settings-header p {
    color: #8f9aaa;
}

body.dark .settings-card {
    background: #171c27;
    border-color: #293241;
}

body.dark .settings-card-head {
    border-color: #293241;
}

body.dark .settings-card-head h2 {
    color: #eef2f8;
}

body.dark .settings-card-head p {
    color: #8f9aaa;
}

body.dark .settings-status {
    background: #202734;
    color: #aeb7c5;
}

body.dark .settings-field label,
body.dark .api-key-wrapper label {
    color: #aeb7c5;
}

body.dark .settings-field input,
body.dark .api-key-row input {
    background: #141923;
    border-color: #293241;
    color: #eef2f8;
}

body.dark .settings-btn.secondary {
    background: #202734;
    border-color: #293241;
    color: #c4ccd7;
}

body.dark .api-warning {
    background: #2c2617;
    border-color: #4b3e20;
    color: #d6b85e;
}


/* Extractor dark */

body.dark .extractor-card {
    background: #171c27;
    border-color: #293241;
}

body.dark .extractor-header h2,
body.dark .extractor-label label,
body.dark .extractor-result-head h3 {
    color: #eef2f8;
}

body.dark .extractor-header p,
body.dark .extractor-info,
body.dark .extractor-result-head p {
    color: #8f9aaa;
}

body.dark .extractor-input textarea {
    background: #141923;
    border-color: #293241;
    color: #eef2f8;
}

body.dark .extractor-input textarea::placeholder {
    color: #6f7a8b;
}

body.dark .extractor-input textarea:focus {
    border-color: #4b8df8;
    box-shadow: 0 0 0 3px rgba(75, 141, 248, .1);
}

body.dark .extractor-actions .clear-btn,
body.dark .extractor-file,
body.dark .extractor-result-actions button {
    background: #202734;
    border-color: #293241;
    color: #c4ccd7;
}

body.dark .extractor-actions .clear-btn:hover,
body.dark .extractor-file:hover,
body.dark .extractor-result-actions button:hover {
    background: #252d3a;
}

body.dark .extractor-result textarea {
    background: #141923;
    border-color: #293241;
    color: #eef2f8;
}

body.dark .extractor-result textarea::placeholder {
    color: #6f7a8b;
}

body.dark .extractor-result-head strong {
    color: #60a5fa;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 1100px) {

    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .row {
        grid-template-columns: 1fr;
    }

    .tools {
        grid-template-columns: 1fr;
    }

}


@media (max-width: 800px) {

    .extractor-form {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .extractor-label {
        padding-top: 0;
    }

    .extractor-input textarea {
        height: 240px;
    }

}


@media (max-width: 760px) {

    .sidebar {
        transform: translateX(-100%);
        transition: .2s;
    }

    .sidebar.open {
        transform: none;
    }

    main {
        margin-left: 0;
    }

    header {
        padding: 0 16px;
    }

    .mobile {
        display: block;
        border: 0;
        background: none;
        font-size: 20px;
        margin-right: auto;
    }

    .search {
        display: none;
    }

    .content {
        padding: 22px 16px;
    }

    .welcome {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .stats {
        grid-template-columns: 1fr 1fr;
    }

}


@media (max-width: 700px) {

    .settings-header h1 {
        font-size: 21px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .settings-field.full {
        grid-column: auto;
    }

    .settings-card-head {
        align-items: flex-start;
    }

    .settings-actions {
        justify-content: stretch;
    }

    .settings-actions .settings-btn {
        width: 100%;
    }

    .api-box {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }

    .api-key-row {
        flex-direction: column;
    }

    .api-key-row .settings-btn {
        width: 100%;
    }

    .extractor-card {
        padding: 16px;
    }

    .extractor-header {
        margin-bottom: 18px;
    }

    .extractor-header h2 {
        font-size: 14px;
    }

    .extractor-actions {
        flex-wrap: wrap;
    }

    .extractor-actions button,
    .extractor-file {
        flex: 1;
        min-width: 100px;
    }

    .extractor-result-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .extractor-result-actions {
        width: 100%;
    }

    .extractor-result-actions button {
        flex: 1;
    }

    .extractor-result textarea {
        height: 220px;
    }

}


@media (max-width: 600px) {

    .tablecard .cardhead {
        flex-direction: column;
        align-items: stretch;
    }

    .tablecard .filter {
        width: 100%;
    }

    .tablecard table {
        min-width: 680px;
    }

    .error-icon {
        font-size: 70px;
    }

    .error-actions {
        flex-direction: column;
        width: 100%;
        max-width: 220px;
    }

    .error-actions a {
        width: 100%;
    }

}


@media (max-width: 480px) {

    .stats {
        grid-template-columns: 1fr;
    }

    .tools {
        grid-template-columns: 1fr;
    }

    .welcome h1 {
        font-size: 21px;
    }

    .settings-card-head {
        flex-direction: column;
    }

    .settings-status {
        align-self: flex-start;
    }

}


@media (max-width: 400px) {

    .extractor-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .extractor-actions button,
    .extractor-file {
        width: 100%;
        flex: none;
    }

}
/* =========================================================
   DOMAIN & IP EXTRACTOR
   ========================================================= */

.extractor-page {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
}

.extractor-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
}

.extractor-header h1 {
    margin: 0 0 6px;
    font-size: 24px;
    line-height: 1.3;
    font-weight: 700;
    color: #172033;
}

.extractor-header p {
    margin: 0;
    color: #8b95a5;
    font-size: 12px;
    line-height: 1.6;
}


/* =========================================================
   MAIN CARD
   ========================================================= */

.extractor-card {
    background: #fff;
    border: 1px solid #e7ebf1;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.03);
}

.extractor-form {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
    gap: 22px;
}

.extractor-input,
.extractor-options {
    min-width: 0;
}


/* =========================================================
   LABELS
   ========================================================= */

.extractor-input label,
.extractor-options > label {
    display: block;
    margin-bottom: 7px;
    color: #344054;
    font-size: 11px;
    font-weight: 600;
}

.extractor-options > label span {
    color: #98a2b3;
    font-weight: 400;
}


/* =========================================================
   TEXTAREA
   ========================================================= */

.extractor-input textarea,
.extractor-options input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #dfe4ea;
    border-radius: 7px;
    background: #fff;
    color: #172033;
    outline: none;
    font-family: inherit;
    font-size: 12px;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.extractor-input textarea {
    min-height: 235px;
    resize: vertical;
    padding: 12px;
    line-height: 1.6;
}

.extractor-options input[type="text"] {
    height: 38px;
    padding: 0 11px;
    margin-bottom: 13px;
}

.extractor-input textarea::placeholder,
.extractor-options input::placeholder,
.result-output::placeholder {
    color: #a5adba;
}

.extractor-input textarea:focus,
.extractor-options input[type="text"]:focus,
.result-output:focus {
    border-color: var(--theme-primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(var(--theme-rgb, 37, 99, 235), .08);
}


/* =========================================================
   CHECKBOX
   ========================================================= */

.check-option {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 3px 0 15px !important;
    color: #667085 !important;
    font-weight: 500 !important;
}

.check-option input {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: var(--theme-primary, #2563eb);
    cursor: pointer;
}

.check-option span {
    color: #667085 !important;
}


/* =========================================================
   BUTTONS
   ========================================================= */

.extractor-btn {
    width: 100%;
    min-height: 38px;
    border: 0;
    border-radius: 7px;
    padding: 9px 14px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition:
            background .2s ease,
            transform .1s ease,
            opacity .2s ease;
}

.extractor-btn:active {
    transform: translateY(1px);
}

.extractor-btn:disabled {
    cursor: not-allowed;
}

.extractor-btn.primary {
    background: var(--theme-primary, #2563eb);
    color: #fff;
    margin-bottom: 9px;
}

.extractor-btn.primary:hover {
    background: var(--theme-hover, #1d4ed8);
}

.extractor-btn.success {
    background: #16a34a;
    color: #fff;
}

.extractor-btn.success:hover {
    background: #15803d;
}


/* =========================================================
   STATUS
   ========================================================= */

.extractor-status {
    min-height: 18px;
    margin-top: 11px;
    color: #667085;
    font-size: 11px;
    line-height: 1.5;
}

.extractor-status:not(:empty) {
    padding: 8px 10px;
    border-radius: 6px;
    background: #f5f8fc;
    border: 1px solid #e8edf3;
}


/* =========================================================
   DIVIDER
   ========================================================= */

.extractor-divider {
    height: 1px;
    margin: 22px 0;
    background: #edf0f4;
}


/* =========================================================
   RESULT HEADER
   ========================================================= */

.result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.result-head h3 {
    margin: 0 0 3px;
    color: #172033;
    font-size: 14px;
    font-weight: 700;
}

.result-head span {
    color: #98a2b3;
    font-size: 10px;
}


/* =========================================================
   RESULT TEXTAREA
   ========================================================= */

.result-output {
    display: block;
    width: 100%;
    min-height: 180px;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid #dfe4ea;
    border-radius: 7px;
    background: #fafbfc;
    color: #344054;
    outline: none;
    resize: vertical;
    font-family: "Courier New", monospace;
    font-size: 11px;
    line-height: 1.7;
}


/* =========================================================
   IP TABLE
   ========================================================= */

.ip-table-result {
    width: 100%;
    margin-top: 18px;
}

.ip-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e7ebf1;
    border-radius: 8px;
}

.ip-table {
    width: 100%;
    min-width: 650px;
    border-collapse: collapse;
    background: #fff;
}

.ip-table th {
    padding: 11px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e7ebf1;
    color: #667085;
    font-size: 10px;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

.ip-table td {
    padding: 11px 12px;
    border-bottom: 1px solid #edf0f4;
    color: #475467;
    font-size: 11px;
    vertical-align: top;
}

.ip-table tbody tr:last-child td {
    border-bottom: 0;
}

.ip-table tbody tr:hover {
    background: #fafcff;
}

.ip-table td:first-child {
    width: 130px;
    white-space: nowrap;
}

.ip-table td:nth-child(3) {
    width: 70px;
    text-align: center;
}

.ip-table td:last-child {
    width: 70px;
    text-align: right;
}

.ip-table strong {
    color: #172033;
    font-size: 11px;
}


/* =========================================================
   DOMAIN LIST
   ========================================================= */

.ip-domain-list {
    margin: 0;
    padding: 0;
    max-height: 180px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    background: transparent;
    color: #475467;
    font-family: "Courier New", monospace;
    font-size: 10px;
    line-height: 1.7;
}


/* =========================================================
   COPY BUTTON
   ========================================================= */

.ip-copy-btn {
    border: 1px solid #d8dee7;
    border-radius: 6px;
    padding: 6px 10px;
    background: #fff;
    color: #475467;
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition:
            background .2s ease,
            border-color .2s ease,
            color .2s ease;
}

.ip-copy-btn:hover {
    background: #f5f8fc;
    border-color: var(--theme-primary, #2563eb);
    color: var(--theme-primary, #2563eb);
}


/* =========================================================
   DARK MODE
   ========================================================= */

body.dark .extractor-header h1 {
    color: #f1f5f9;
}

body.dark .extractor-header p {
    color: #8b95a5;
}

body.dark .extractor-card {
    background: #111827;
    border-color: #1f2937;
    box-shadow: none;
}

body.dark .extractor-input label,
body.dark .extractor-options > label {
    color: #d1d5db;
}

body.dark .extractor-options > label span {
    color: #6b7280;
}

body.dark .extractor-input textarea,
body.dark .extractor-options input[type="text"] {
    background: #0f172a;
    border-color: #263244;
    color: #e5e7eb;
}

body.dark .extractor-input textarea:focus,
body.dark .extractor-options input[type="text"]:focus,
body.dark .result-output:focus {
    border-color: var(--theme-primary, #3b82f6);
}

body.dark .check-option span {
    color: #9ca3af !important;
}

body.dark .extractor-status:not(:empty) {
    background: #172033;
    border-color: #263244;
    color: #9ca3af;
}

body.dark .extractor-divider {
    background: #1f2937;
}

body.dark .result-head h3 {
    color: #f1f5f9;
}

body.dark .result-head span {
    color: #6b7280;
}

body.dark .result-output {
    background: #0f172a;
    border-color: #263244;
    color: #d1d5db;
}

body.dark .ip-table-wrapper {
    border-color: #263244;
}

body.dark .ip-table {
    background: #111827;
}

body.dark .ip-table th {
    background: #172033;
    border-color: #263244;
    color: #9ca3af;
}

body.dark .ip-table td {
    border-color: #1f2937;
    color: #9ca3af;
}

body.dark .ip-table tbody tr:hover {
    background: #172033;
}

body.dark .ip-table strong {
    color: #e5e7eb;
}

body.dark .ip-domain-list {
    color: #cbd5e1;
}

body.dark .ip-copy-btn {
    background: #172033;
    border-color: #334155;
    color: #cbd5e1;
}

body.dark .ip-copy-btn:hover {
    background: #1e293b;
    border-color: var(--theme-primary, #3b82f6);
    color: #60a5fa;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 850px) {

    .extractor-form {
        grid-template-columns: 1fr;
    }

    .extractor-input textarea {
        min-height: 190px;
    }

}


@media (max-width: 600px) {

    .extractor-page {
        max-width: 100%;
    }

    .extractor-header {
        margin-bottom: 15px;
    }

    .extractor-header h1 {
        font-size: 20px;
    }

    .extractor-header p {
        font-size: 11px;
    }

    .extractor-card {
        padding: 14px;
        border-radius: 8px;
    }

    .extractor-input textarea {
        min-height: 170px;
    }

    .result-output {
        min-height: 150px;
    }

    .result-head {
        align-items: flex-start;
    }

    .ip-table {
        min-width: 600px;
    }

}


.stats.stats-personal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 600px) { .stats.stats-personal { grid-template-columns: 1fr; } }

/* Mobile navigation */
.mobile-navigation, .sidebar-close, .sidebar-backdrop { display: none; }
.sidebar nav { min-height: 0; overflow-y: auto; flex: 1; }
.sidebar .profile-info { min-width: 0; }
.sidebar .profile-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
    .mobile-navigation { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; min-height: 60px; padding: 10px 16px; background: #fff; border-bottom: 1px solid #e8ecf2; }
    .mobile-menu-button { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #e8ecf2; border-radius: 9px; background: #f8fafc; color: #172033; font-size: 21px; }
    .mobile-navigation-brand { font-size: 14px; font-weight: 700; }
    .mobile-navigation-brand small { display: block; margin-top: 2px; font-size: 9px; font-weight: 400; color: #8a94a6; }
    .sidebar { visibility: hidden; z-index: 60; width: min(290px, calc(100vw - 48px)); transition: transform .2s ease, visibility .2s; }
    .sidebar.open { visibility: visible; }
    .sidebar-close { display: grid; place-items: center; position: absolute; top: 23px; right: 14px; width: 30px; height: 30px; border: 0; border-radius: 7px; color: #64748b; background: #f1f5f9; font-size: 24px; }
    .sidebar .brand { padding-right: 32px; }
    .sidebar-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 50; border: 0; background: #0f172a80; }
    body.navigation-open { overflow: hidden; }
    body.dark .mobile-navigation { background: #111827; border-color: #263244; }
    body.dark .mobile-menu-button, body.dark .sidebar-close { background: #1e293b; border-color: #334155; color: #e2e8f0; }
    :is(.mobile-menu-button,.sidebar-close):focus-visible { outline: 2px solid var(--theme-primary,#2563eb); outline-offset: 3px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
.chat-nav-badge:not([hidden]) { display:inline-flex; align-items:center; justify-content:center; min-width:19px; padding:3px 5px; margin-left:auto; border-radius:6px; background:var(--theme-primary,#2563eb); color:#fff; font-size:9px; }
/* IP extractor file picker */
.ip-extractor-page .ip-upload { position:relative;display:flex;align-items:center;gap:16px;padding:20px;margin:18px 0;border:1px dashed var(--theme-primary,#37651e);border-radius:12px;background:var(--theme-soft,#f2f6ed);cursor:pointer;transition:box-shadow .15s,background .15s; }
.ip-extractor-page .ip-upload:hover { box-shadow:0 4px 18px #173b1810; }
.ip-upload-icon { display:grid;place-items:center;flex-shrink:0;width:46px;height:46px;border-radius:12px;background:var(--theme-primary,#37651e);color:#fff;font-size:29px; }
.ip-upload-copy { display:flex;flex:1;min-width:0;flex-direction:column;gap:6px; }.ip-upload-copy strong { font-size:13px; }.ip-upload-copy small { font-size:10px;opacity:.6; }
#ipFileName { font-size:11px;overflow-wrap:anywhere;color:var(--theme-primary,#37651e); }#ipFileName:empty { display:none; }
.ip-upload-browse { border:1px solid #8883;border-radius:7px;padding:10px 13px;font-size:11px;white-space:nowrap;background:#fff9; }
.ip-extractor-page .ip-upload input { position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer; }
.ip-extractor-page .ip-upload:focus-within { outline:2px solid var(--theme-primary,#37651e);outline-offset:4px; }
body.dark .ip-extractor-page .ip-upload { background:#202c26;color:#e5ecdf; }body.dark .ip-upload-browse { background:#ffffff0b; }
@media(max-width:550px) { .ip-extractor-page .ip-upload { padding:16px;gap:12px;flex-wrap:wrap; }.ip-upload-browse { margin-inline-start:58px; }.ip-upload-copy { flex-basis:calc(100% - 60px); } }
/* A quiet, theme-aware navigation scroll rail. */
.sidebar nav { scrollbar-width:thin;scrollbar-color:#a6b5a280 transparent;scrollbar-gutter:stable;overscroll-behavior:contain;padding-inline-end:6px; }
.sidebar nav:hover { scrollbar-color:var(--theme-primary,#37651e) transparent; }
.sidebar nav::-webkit-scrollbar { width:5px; }
.sidebar nav::-webkit-scrollbar-track { background:transparent; }
.sidebar nav::-webkit-scrollbar-thumb { background:#a6b5a280;border-radius:20px; }
.sidebar nav::-webkit-scrollbar-thumb:hover { background:var(--theme-primary,#37651e); }
body.dark .sidebar nav { scrollbar-color:#607363 transparent; }
.ip-extractor-page .ip-upload { border-style:solid;background:linear-gradient(115deg,var(--theme-soft,#f2f6ed),#ffffff80);box-shadow:0 3px 14px #18391d06; }
.ip-extractor-page .ip-upload-icon { box-shadow:0 5px 12px #173b1818; }
.ip-extractor-page .ip-upload-browse { background:var(--theme-primary,#37651e);color:#fff;border-color:transparent;font-weight:600; }
