:root{
    --bg:#f4f7fb;
    --card:#fff;
    --text:#17233d;
    --muted:#6f7b91;
    --line:#e1e7ef;

    --blue:#2f6fed;
    --blue-soft:#eaf1ff;

    --green:#16885c;
    --green-soft:#dcefe6;

    --red:#b84444;
    --red-soft:#f6dddd;

    --yellow-soft:#fff4cc;

    --shadow:
        0 1px 2px rgba(15,30,55,.05),
        0 6px 24px rgba(15,30,55,.04);
}

*{
    box-sizing:border-box;
}

html,
body{
    margin:0;
    padding:0;
}

body{
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background:var(--bg);
    color:var(--text);
    font-size:14px;
}

a{
    color:var(--blue);
    text-decoration:none;
}

a:hover{
    text-decoration:underline;
}


/* TOP BAR */

.topbar{
    height:58px;
    background:#fff;
    border-bottom:1px solid var(--line);

    display:flex;
    align-items:center;
    justify-content:space-between;

    padding:0 24px;

    position:sticky;
    top:0;
    z-index:20;
}

.brand{
    font-size:18px;
    font-weight:800;
    color:#153b78;
    text-decoration:none;
}

.topbar nav{
    display:flex;
    gap:18px;
}


/* LAYOUT */

.container{
    max-width:1480px;
    margin:0 auto;
    padding:22px;
}

h1{
    font-size:22px;
    margin:0 0 7px;
}

h2{
    font-size:17px;
    margin:0 0 14px;
}

.muted{
    color:var(--muted);
}

.small{
    font-size:12px;
}

.card{
    background:var(--card);
    border:1px solid var(--line);
    border-radius:10px;
    box-shadow:var(--shadow);
}


/* PAGE HEADER */

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

    gap:20px;
    margin:2px 0 18px;
}

.page-head p{
    margin:0;
}

.breadcrumbs{
    font-size:12px;
    color:var(--muted);
    margin-bottom:7px;
}

.head-actions{
    display:flex;
    gap:8px;
}


/* ICON BUTTONS */

.icon-btn{
    width:38px;
    height:38px;

    border:0;
    border-radius:50%;

    color:#fff;
    font-size:22px;
    line-height:38px;

    cursor:pointer;

    display:inline-flex;
    align-items:center;
    justify-content:center;
}

.icon-btn.blue{
    background:#81a8ff;
}

.icon-btn.green{
    background:#86c5a8;
}


/* PROJECT LIST */

.projects-grid{
    display:grid;
    grid-template-columns:
        repeat(auto-fill,minmax(290px,1fr));

    gap:14px;
    margin:18px 0 22px;
}

.project-card{
    padding:18px;
    color:inherit;
    text-decoration:none;
    transition:.15s ease;
}

.project-card:hover{
    transform:translateY(-1px);
    border-color:#c9d6e8;
    text-decoration:none;
}

.project-title{
    font-weight:800;
    font-size:16px;
}

.project-domain{
    color:var(--blue);
    margin-top:3px;
}

.project-meta{
    display:flex;
    gap:8px;
    flex-wrap:wrap;

    margin:14px 0 12px;
}

.project-meta span{
    background:#f0f3f8;
    padding:4px 8px;
    border-radius:999px;
    font-size:12px;
}

.mini-stats{
    display:flex;
    gap:13px;
    flex-wrap:wrap;
    margin-bottom:8px;
}

.mini-stats span{
    font-size:12px;
    color:var(--muted);
}

.mini-stats b{
    color:var(--text);
}


/* FORMS */

.form-card{
    padding:18px;
    margin:18px 0;
}

.form-card.compact{
    max-width:820px;
}

.form-grid{
    display:grid;
    grid-template-columns:
        repeat(4,minmax(160px,1fr));

    gap:14px;
}

label{
    display:flex;
    flex-direction:column;
    gap:6px;
    font-weight:650;
}

label small{
    font-weight:400;
    color:var(--muted);
}

input,
select,
textarea{
    font:inherit;

    padding:10px 11px;

    border:1px solid #ccd6e3;
    border-radius:7px;

    background:#fff;
    color:var(--text);

    outline:none;
}

input:focus,
select:focus,
textarea:focus{
    border-color:#86a9ee;
    box-shadow:0 0 0 3px #e9f0ff;
}

textarea{
    resize:vertical;
}

.form-actions{
    display:flex;
    align-items:flex-end;
}


/* BUTTONS */

.btn{
    border:0;
    border-radius:7px;

    padding:10px 14px;

    font-weight:750;
    cursor:pointer;
}

.btn.primary{
    background:var(--blue);
    color:white;
}

.btn.danger{
    background:#fff0f0;
    color:#a83232;
    border:1px solid #efc4c4;
}


/* LOGIN */

.login-card{
    max-width:420px;
    margin:80px auto;
    padding:28px;
}

.login-card form{
    display:flex;
    flex-direction:column;
    gap:14px;
}


/* FLASH */

.flash{
    border-radius:8px;
    padding:10px 13px;
    margin-bottom:14px;
    border:1px solid transparent;
}

.flash.success{
    background:#e5f5ed;
    border-color:#b9e4cf;
    color:#126642;
}

.flash.error{
    background:#fdeaea;
    border-color:#f4c6c6;
    color:#972d2d;
}

.flash.warning{
    background:var(--yellow-soft);
    border-color:#eddc92;
    color:#6b5612;
}


/* STATS */

.stats-row{
    display:grid;
    grid-template-columns:
        repeat(6,minmax(110px,1fr));

    gap:10px;
    margin:0 0 16px;
}

.stat{
    background:#fff;
    border:1px solid var(--line);
    border-radius:9px;

    padding:12px 14px;

    display:flex;
    align-items:baseline;
    gap:8px;
}

.stat b{
    font-size:22px;
}

.stat span{
    color:var(--muted);
    font-size:12px;
}


/* TOOLBAR */

.toolbar{
    display:flex;
    align-items:center;
    justify-content:space-between;

    gap:16px;
    margin:14px 0 10px;
}

.range-tabs{
    display:flex;
    gap:6px;
}

.range-tabs a{
    padding:7px 10px;

    border-radius:7px;
    background:#fff;
    border:1px solid var(--line);

    color:var(--text);
}

.range-tabs a.active{
    background:var(--blue);
    border-color:var(--blue);
    color:#fff;
    text-decoration:none;
}

.legend{
    display:flex;
    align-items:center;

    gap:7px;
    flex-wrap:wrap;

    color:var(--muted);
    font-size:12px;
}

.dot{
    width:9px;
    height:9px;
    border-radius:50%;
    display:inline-block;
}

.dot.up{
    background:#5eaa82;
}

.dot.down{
    background:#d17c7c;
    margin-left:7px;
}

.hidden{
    display:none!important;
}


/* TABLE */

.table-wrap{
    overflow:auto;
    border-radius:8px;
}

.rank-table{
    width:100%;
    min-width:1050px;

    border-collapse:separate;
    border-spacing:0;
}

.rank-table th,
.rank-table td{
    border-bottom:1px solid var(--line);

    padding:10px 12px;

    text-align:center;
    white-space:nowrap;
}

.rank-table thead th{
    font-weight:800;
    background:#fff;

    position:sticky;
    top:0;
    z-index:3;
}

.rank-table tbody tr:nth-child(odd) td{
    background:#fbfcfe;
}

.rank-table tbody tr:hover td{
    filter:brightness(.985);
}


/* FRAZA */

.rank-table .keyword-col{
    text-align:left;

    min-width:370px;
    max-width:480px;

    position:sticky;
    left:0;
    z-index:2;

    background:#fff;
}

.rank-table tbody tr:nth-child(odd) .keyword-col{
    background:#fbfcfe;
}

.rank-table thead .keyword-col{
    z-index:4;
}


/* WYSZUKIWANIA - WYROZNIONA KOLUMNA */

.volume-col{
    min-width:88px;
    width:88px;

    text-align:center!important;

    font-weight:750;
    color:#315b8f!important;

    background:#eef4fb!important;

    border-left:1px solid #d9e4f1!important;
    border-right:2px solid #bccfe4!important;
}

.rank-table thead .volume-col{
    background:#dfeaf6!important;
    color:#173d6b!important;
    font-weight:850;

    border-left:1px solid #ccdced!important;
    border-right:2px solid #adc4dc!important;
}

.rank-table tbody tr:nth-child(odd) .volume-col{
    background:#e9f1fa!important;
}

.rank-table tbody tr:hover .volume-col{
    background:#e3edf8!important;
    filter:none;
}


/* TODAY + CHANGES */

.rank-table th.today{
    text-decoration:underline;
    text-decoration-thickness:2px;
    text-underline-offset:4px;
}

.rank-table td.cell-up{
    background:var(--green-soft)!important;
}

.rank-table td.cell-down{
    background:var(--red-soft)!important;
}


/* KEYWORD CONTENT */

.kw-line{
    display:flex;
    align-items:center;
    gap:8px;
}

.kw{
    font-size:14px;
    font-weight:600;
}

.ranking-url{
    font-size:10px;
    color:#526177;

    margin-top:3px;

    max-width:430px;

    overflow:hidden;
    text-overflow:ellipsis;
}

.inline-form{
    display:inline;
}

.tiny-icon{
    border:0;
    background:transparent;

    color:#85a9f7;

    cursor:pointer;
    padding:0;

    font-size:14px;
}


/* STATUS DOT */

.status-dot{
    width:8px;
    height:8px;
    min-width:8px;

    padding:0;
    margin-left:4px;

    border-radius:50%;

    display:inline-block;

    cursor:pointer;
    vertical-align:middle;
}

.status-dot.status-on{
    background:#7da5f8;
    border:1px solid #7da5f8;
}

.status-dot.status-off{
    background:transparent;
    border:1px solid #7da5f8;
}


/* DELTA */

.delta{
    display:block;
    font-size:9px;
    font-weight:800;
    margin-top:2px;
    line-height:1.1;
}

.delta-up{
    color:var(--green);
}

.delta-down{
    color:var(--red);
}

.inactive-row{
    opacity:.48;
}

.empty{
    text-align:center!important;
    color:var(--muted);

    padding:28px!important;
}


/* DANGER */

.danger-zone{
    margin-top:18px;
    padding:16px;

    display:flex;
    align-items:center;
    justify-content:space-between;
}

.danger-zone div{
    display:flex;
    flex-direction:column;
    gap:3px;
}


/* CHART */

.chart-card{
    padding:12px;
    margin-bottom:16px;
    overflow:auto;
}

.rank-chart{
    min-width:720px;
    width:100%;
    height:auto;
}

.grid-line{
    stroke:#e3e9f1;
    stroke-width:1;
}

.axis-text{
    fill:#78859a;
    font-size:11px;
}

.chart-line{
    fill:none;
    stroke:#2f6fed;
    stroke-width:2.5;

    stroke-linecap:round;
    stroke-linejoin:round;
}

.chart-dot{
    fill:#fff;
    stroke:#2f6fed;
    stroke-width:2.5;
}


/* HISTORY */

.history-card{
    overflow:auto;
}

.history-table{
    width:100%;
    border-collapse:collapse;
}

.history-table th,
.history-table td{
    padding:10px 12px;

    border-bottom:1px solid var(--line);

    text-align:left;
}

.history-table th{
    background:#fafbfd;
}


/* RESPONSIVE */

@media(max-width:900px){

    .container{
        padding:14px;
    }

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

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

    .page-head{
        flex-direction:column;
    }

    .toolbar{
        align-items:flex-start;
        flex-direction:column;
    }
}

@media(max-width:560px){

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

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

/* =========================================================
   WIDOK MIESIECZNY
   ========================================================= */

.month-toolbar{
    display:flex;
    align-items:center;
    gap:10px;
    margin:14px 0 10px;
}

.month-title{
    min-width:180px;
    text-align:center;
    font-size:16px;
    font-weight:800;
    color:#173d6b;
}

.month-title span{
    display:block;
    margin-top:2px;
    font-size:10px;
    font-weight:500;
    color:#7a8798;
}

.month-arrow{
    width:34px;
    height:34px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#fff;
    border:1px solid #d7e0ec;
    border-radius:7px;
    font-size:18px;
    font-weight:700;
    color:#2f6fed;
    text-decoration:none;
}

.month-arrow:hover{
    background:#f1f5fb;
    text-decoration:none;
}

.month-arrow.disabled{
    opacity:.3;
    cursor:default;
}

.month-legend{
    margin-left:auto;
}


/* Pelny miesiac ma sie miescic na ekranie */

.monthly-table{
    width:100% !important;
    min-width:0 !important;
}


/* Fraza */

.monthly-table .keyword-col{
    min-width:260px !important;
    width:260px !important;
    max-width:260px !important;
}

.monthly-table .ranking-url{
    max-width:245px !important;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.monthly-table .kw{
    font-size:13px;
}


/* Wyszukiwania */

.monthly-table .volume-col{
    min-width:70px !important;
    width:70px !important;
    max-width:70px !important;
    padding-left:5px !important;
    padding-right:5px !important;
}


/* Kolumny dni */

.monthly-table th:not(.keyword-col):not(.volume-col),
.monthly-table td:not(.keyword-col):not(.volume-col){
    min-width:32px !important;
    width:32px !important;
    max-width:32px !important;
    padding-left:3px !important;
    padding-right:3px !important;
    font-size:12px;
}

.monthly-table thead th:not(.keyword-col):not(.volume-col){
    font-size:11px;
}

.monthly-table th,
.monthly-table td{
    padding-top:8px;
    padding-bottom:8px;
}


/* Weekend nie ma osobnego tla - korzystamy z przeplatanca */

.monthly-table thead th.weekend{
    color:inherit;
}

.monthly-table td.weekend-cell{
    box-shadow:none !important;
}


/* Delikatny pionowy przeplataniec:
   dzien 1 bialy, dzien 2 lekko szary itd. */

.monthly-table thead th:nth-child(odd):not(.volume-col):not(.keyword-col),
.monthly-table tbody td:nth-child(odd):not(.volume-col):not(.keyword-col){
    background:#fff !important;
}

.monthly-table thead th:nth-child(even):not(.volume-col):not(.keyword-col){
    background:#f8fafc !important;
}

.monthly-table tbody td:nth-child(even):not(.volume-col):not(.keyword-col){
    background:#fafbfd !important;
}


/* Dzisiejszy dzien */

.monthly-table th.today{
    box-shadow:inset 0 -3px 0 var(--blue);
    text-decoration:none;
}


/* Historia miesiecy */

.month-history{
    margin-top:18px;
    padding:16px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
}

.month-history > div{
    display:flex;
    flex-direction:column;
    gap:3px;
}

.month-picker-form{
    display:flex;
    align-items:center;
    gap:8px;
}

.month-picker-form select{
    min-width:170px;
}


/* Responsive miesieczny */

@media(max-width:900px){

    .month-toolbar{
        flex-wrap:wrap;
    }

    .month-legend{
        width:100%;
        margin-left:0;
    }

    .month-history{
        align-items:flex-start;
        flex-direction:column;
    }
}


/* ODSWIEZENIE POJEDYNCZEJ FRAZY */

.keyword-refresh{
    font-size:13px;
    line-height:1;
    color:#7da5f8;
    margin-left:-2px;
}

.keyword-refresh:hover{
    color:var(--blue);
}
