/* COMMON/style.css */
/* ==========================================================
   COMMON/style.css v2.1
   Instalpol / ENOB ecosystem
   Reusable responsive layout + sticky application header
   ========================================================== */
body {
    font-family: Arial, sans-serif;
    width: 100%;
    max-width: 900px;
    margin: 40px auto;
    padding: 0 16px;
    box-sizing: border-box;
    background: #f5f5f5;
    color: #222;
}

* {
    box-sizing: border-box;
}

textarea,
input,
select {
    width: 100%;
    padding: 10px;
    font-size: 16px;
}

textarea {
    height: 180px;
    overflow-y: auto;
    resize: vertical;
    line-height: 1.5;
}

button,
.button {
    display: inline-block;
    padding: 10px 18px;
    cursor: pointer;
    background: #222;
    color: #fff !important;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: opacity .15s ease;
}

button:hover,
.button:hover {
    opacity: 0.9;
    text-decoration: none;
}

.note {
    background: white;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 6px;
    border: 1px solid #ddd;

	word-break: break-word;
	overflow-wrap: break-word;
}

.date {
    color: #666;
    font-size: 14px;
}

a {
    color: #7c3aed;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
}

.logo {
    font-size: 28px;
    font-weight: bold;
}

.counter {
    color: #666;
    font-size: 14px;
}

img {
    max-width: 100%;
}

@media (max-width: 700px) {

    body {
        margin: 20px auto;
        padding: 0 12px;
    }

    h1 {
        font-size: 36px;
    }

    h2 {
        font-size: 28px;
    }

    textarea {
        min-height: 160px;
    }

    button {
        width: 100%;
    }

    .note {
        padding: 12px;
    }

    .counter {
        width: 100%;
    }

}

.hint {
    margin-top: 8px;
    color: #666;
    font-size: 14px;
}

.long-note {
    background: #f3f3f3;
}

.long-note-label {
    margin-top: 6px;
    color: #999;
    font-size: 12px;
    text-transform: uppercase;
}

.login-box {
    width: 100%;
    max-width: 400px;
    margin: 40px auto;
}

.two-columns {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.two-columns > div {
    flex: 1;
    min-width: 0;
}

/* Reusable responsive 3-column grid for KPI and summary cards. */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.grid-3 > * {
    min-width: 0;
    margin-bottom: 0;
}

@media (max-width: 900px) {

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

}

@media (max-width: 700px) {

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

    .two-columns {
        display: block;
    }

    .two-columns > div:last-child {
        margin-top: 30px;
    }

}

.context-title {
    font-size: 22px;
    font-weight: 700;
}

.context-label {
    color: #666;
    font-size: 14px;
    margin-bottom: 6px;
}

.project-subtitle {
    margin-top: -10px;
    margin-bottom: 25px;
    color: #666;
    font-size: 20px;
}

input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

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

th,
td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    vertical-align: top;
}

th {
    font-weight: 700;
    background: #f3f3f3;
}

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

/* Wide data tables, e.g. .ceny product catalogue */
.wide-table-wrap {
    overflow-x: auto;
    width: 100%;
}

.wide-table {
    min-width: 1300px;
}

/* .ceny product catalogue */

body.products-page {
    max-width: 1400px;
}

.nowrap {
    white-space: nowrap;
}

/* ==========================================================
   Reusable table column types
   Shared across Instalpol / ENOB apps
   ========================================================== */

/* Dates, timestamps and other values that should stay on one line */
.col-date {
    min-width: 10ch;
    white-space: nowrap;
}

/* Short labels and compact values, e.g. status, unit, version */
.col-short {
    min-width: 8ch;
    white-space: nowrap;
}

/* Medium text, e.g. client, location, type, manufacturer, supplier */
.col-text {
    min-width: 14ch;
    max-width: 22ch;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: auto;
}

/* Main descriptive text, e.g. concept, observation, document */
.col-title {
    min-width: 34ch;
    overflow-wrap: break-word;
    word-break: normal;
}

/* File names, hashes and export names */
.col-file {
    min-width: 18ch;
    max-width: 24ch;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Plain numeric relation/count columns */
.table-count {
    width: 72px;
    min-width: 72px;
    text-align: center;
    white-space: nowrap;
}

/* Final actions column */
.col-actions {
    min-width: 9ch;
    white-space: nowrap;
}

.manufacturer {
    min-width: 120px;
}

.file-upload {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.file-upload .button {
    display: inline-block;
    padding: 10px 16px;
    background: #222;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
}

#file-name {
    color: #666;
}

body.readings-page,
body.imports-page,
body.dane-page,
body.analysis-page {
    max-width: 1400px;
}

body.analysis-page .wide-table {
    width: auto;
    min-width: 100%;
}

.stats-line {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.actions-right {
    text-align: right;
    margin-bottom: 20px;
}

.top-nav {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    font-size: 15px;

    position: sticky;
    top: 0;
    z-index: 100;

    background: #f5f5f5;
    padding: 12px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid #ddd;
}

.top-nav a {
    color: #7c3aed;
    text-decoration: none;
}

.top-nav a:hover {
    text-decoration: underline;
}

/* ==========================================================
   Reusable sticky application header
   App title left, navigation right, divider below
   ========================================================== */

.app-header {
    position: -webkit-sticky;
    position: sticky !important;
    top: 0;
    z-index: 1000;
    align-self: flex-start;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;

    width: 100%;
    background: #f5f5f5;
    padding: 12px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid #ddd;
}

.app-header .logo {
    flex-shrink: 0;
    font-size: 28px;
    font-weight: 700;
}

.app-header .top-nav {
    position: static;
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    justify-content: flex-end;
}

.app-subtitle {
    margin-bottom: 28px;
}

.status-select {
    width: 120px;
    min-width: 120px;
    padding: 6px 10px;
}

/* .analizy observation decision: longer labels need a wider inline select */
.decision-select {
    width: 170px;
    min-width: 170px;
}


/* ==========================================================
   .wrzutki cards
   ========================================================== */

.wrzutka-note {
    border-left: 6px solid #7c3aed;
}

.wrzutka-note.entry-today {
    background: #e7f3ff;
}

.wrzutka-note.entry-yesterday {
    background: #f3f8fc;
}

.wrzutka-note.wrzutka-color-1 { border-left-color: #7c3aed; }
.wrzutka-note.wrzutka-color-2 { border-left-color: #2563eb; }
.wrzutka-note.wrzutka-color-3 { border-left-color: #16a34a; }
.wrzutka-note.wrzutka-color-4 { border-left-color: #ea580c; }
.wrzutka-note.wrzutka-color-5 { border-left-color: #dc2626; }
.wrzutka-note.wrzutka-color-6 { border-left-color: #0891b2; }

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

.wrzutka-author {
    font-size: 17px;
    font-weight: 700;
}

.wrzutka-date {
    margin-top: 2px;
    color: #666;
    font-size: 14px;
}

.wrzutka-meta {
    flex-shrink: 0;
    text-align: right;
}

.wrzutka-id {
    margin-bottom: 7px;
    color: #999;
    font-size: 14px;
    white-space: nowrap;
}

.wrzutka-status-form {
    margin: 0;
}

.wrzutka-content {
    font-size: 17px;
    line-height: 1.45;
}

.wrzutka-actions {
    margin-top: 18px;
}


/* ==========================================================
   Reusable record cards (.wrzutki, .godziny, future apps)
   ========================================================== */

.record-card {
    background: #fff;
    border: 1px solid #ddd;
    border-left: 6px solid #7c3aed;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;

    word-break: break-word;
    overflow-wrap: break-word;
}

.record-card.record-color-1 { border-left-color: #7c3aed; }
.record-card.record-color-2 { border-left-color: #2563eb; }
.record-card.record-color-3 { border-left-color: #16a34a; }
.record-card.record-color-4 { border-left-color: #ea580c; }
.record-card.record-color-5 { border-left-color: #dc2626; }
.record-card.record-color-6 { border-left-color: #0891b2; }

.record-card:last-child {
    margin-bottom: 0;
}

.record-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.record-author {
    font-weight: 700;
    font-size: 17px;
}

.record-date {
    margin-top: 2px;
    color: #666;
    font-size: 14px;
}

.record-id {
    color: #999;
    font-size: 14px;
    white-space: nowrap;
}

.record-content {
    font-size: 17px;
    line-height: 1.45;
}

.record-actions {
    margin-top: 18px;
}


/* ==========================================================
   Responsive KISS baseline for .analizy and shared apps
   ========================================================== */

html {
    width: 100%;
}

body {
    overflow: visible;
}

.page {
    width: 100%;
    max-width: 100%;
    overflow: visible;
}

.table-wrap,
.wide-table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.wide-table-wrap .wide-table,
body.analysis-page .wide-table {
    width: auto;
    min-width: 100%;
}

/* Primary descriptive column: readable in mobile, tablet and narrow desktop windows */
@media (max-width: 1200px) {
    .table-primary-text {
        min-width: 24ch;
    }
}

.table-wrap th,
.wide-table-wrap th {
    white-space: nowrap;
}

.table-wrap td form,
.wide-table-wrap td form {
    margin: 0;
}

.table-wrap td button,
.wide-table-wrap td button {
    width: auto;
    white-space: nowrap;
    padding: 8px 12px;
}

@media (max-width: 700px) {

    .topbar {
        display: block;
        margin-bottom: 20px;
    }

    .topbar > div,
    .topbar > nav,
    .topbar > a {
        margin-bottom: 10px;
    }


    button,
    .button {
        width: 100%;
        text-align: center;
        margin-bottom: 8px;
    }

    .actions-right {
        text-align: left;
    }

    .table-wrap,
    .wide-table-wrap {
        margin-left: -12px;
        margin-right: -12px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .table-wrap td button,
    .wide-table-wrap td button {
        width: auto;
        margin-bottom: 0;
    }

    .app-header {
        align-items: flex-start;
    }

    .app-header .top-nav {
        width: 100%;
        justify-content: flex-start;
        gap: 10px 14px;
    }

    .wrzutka-head {
        flex-wrap: wrap;
    }

    .wrzutka-meta {
        width: 100%;
        text-align: left;
    }

    .status-select {
        width: 120px;
    }
}

/* ==========================================================
   .godziny compact record cards
   Scoped override: shared CSS remains safe for other apps
   ========================================================== */

.godziny-card {
    padding: 14px 16px;
    margin-bottom: 12px;
}

.godziny-card.entry-today {
    background: #e7f3ff;
}

.godziny-card.entry-yesterday {
    background: #f3f8fc;
}

.godziny-card .record-head {
    gap: 10px;
    margin-bottom: 10px;
}

.godziny-card .record-author {
    line-height: 1.2;
}

.godziny-card .record-date {
    margin-top: 1px;
    line-height: 1.2;
}

.godziny-card .record-meta {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 14px;
    flex-shrink: 0;
}

.godziny-card .record-hours {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
}

.godziny-card .record-id {
    font-size: 13px;
    line-height: 1.2;
}

.godziny-card .record-content {
    font-size: 16px;
    line-height: 1.35;
}

.godziny-card .record-content p {
    margin: 6px 0;
}

.godziny-card .record-content .two-columns {
    gap: 24px;
}

.godziny-card .record-actions {
    margin-top: 10px;
}

@media (max-width: 700px) {

    .godziny-card {
        padding: 12px 14px;
    }

    .godziny-card .record-content .two-columns {
        display: block;
    }

    .godziny-card .record-content .two-columns > div:last-child {
        margin-top: 6px;
    }

    .godziny-card .record-meta {
        gap: 10px;
    }

    .godziny-card .record-hours {
        font-size: 20px;
    }

    .godziny-card .record-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .godziny-card .record-actions .button {
        flex: 0 0 30%;
        width: 30%;
        min-width: 96px;
        max-width: 130px;
        margin-bottom: 0;
    }
}

/* ==========================================================
   Reusable analysis delta emphasis
   Shared across Instalpol / ENOB apps
   ========================================================== */

.analysis-delta-row th,
.analysis-delta-row td {
    background: #fafafa;
}

.analysis-delta-cell {
    white-space: nowrap;
}

.analysis-delta-positive {
    color: #b91c1c;
}

.analysis-delta-negative {
    color: #15803d;
}

.analysis-delta-low {
    background: #fff8e1 !important;
}

.analysis-delta-medium {
    background: #ffefc2 !important;
}

.analysis-delta-high {
    background: #ffe39a !important;
}

.analysis-delta-max {
    background: #ffd66b !important;
}

.analysis-delta-big {
    font-weight: 700;
}

/* Reusable weekend marker for day-level analysis rows. */
.weekend-date {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f1f1f1;
    color: #666;
    white-space: nowrap;
}

/* ==========================================================
   Submeter review focus tools
   Sticky context + muted insignificant changes
   ========================================================== */

.submeter-review-table th:first-child,
.submeter-review-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
}

.submeter-review-table thead th:first-child {
    z-index: 4;
}

.submeter-review-table .submeter-review-period-row th:first-child {
    background: #f3f3f3;
}

.submeter-review-table .analysis-delta-row th:first-child {
    background: #fafafa;
}

.analysis-delta-muted {
    color: #999;
    background: #fafafa !important;
    font-weight: 400;
}

.submeter-review-meter-link {
    color: inherit;
    text-decoration: none;
}

.submeter-review-meter-link:hover {
    color: #7c3aed;
    text-decoration: underline;
}

/* ==========================================================
   Reusable five-column form row
   ========================================================== */
.form-five-columns {
    display: grid;
    grid-template-columns: 1fr 3fr .8fr .8fr 1.2fr;
    gap: 12px;
    align-items: end;
}

@media (max-width: 900px) {
    .form-five-columns {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================
   Data consistency preview
   ========================================================== */
.consistency-preview > h2 {
    margin-bottom: 6px;
}

.consistency-series {
    padding: 18px 0;
    border-top: 1px solid #ddd;
}

.consistency-series:first-of-type {
    margin-top: 16px;
}

.consistency-series-head {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    justify-content: space-between;
}

.consistency-series-select {
    flex: 1;
    min-width: 0;
}

.consistency-series-select strong {
    display: block;
    margin-bottom: 6px;
}

.consistency-periods {
    display: flex;
    gap: 6px;
    flex: 0 0 auto;
}

.consistency-period-button {
    min-width: 42px;
    padding: 10px 12px;
}

.consistency-period-button:not(.is-active) {
    background: #666;
}

.consistency-series-meta {
    margin: 10px 0 8px;
    color: #555;
    font-size: 14px;
}

.consistency-chart-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
}

.consistency-chart {
    display: block;
    width: 100%;
    height: auto;
    min-width: 620px;
}

@media (max-width: 700px) {
    .consistency-series-head {
        display: block;
    }

    .consistency-periods {
        margin-top: 10px;
    }

    .consistency-period-button {
        width: auto;
        flex: 0 0 auto;
    }
}

/* .repo photos V1 */
.project-tool-buttons,
.photo-toolbar-actions,
.photo-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.photo-filter-form {
    display: grid;
    grid-template-columns: minmax(0, 180px) minmax(180px, 1fr) auto;
    gap: 10px;
    align-items: end;
    margin-top: 16px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.photo-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    min-width: 0;
}

.photo-thumb-button {
    display: block;
    width: 100%;
    height: 170px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #eee;
    overflow: hidden;
}

.photo-thumb-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-card-body {
    padding: 10px;
}

.photo-caption {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.photo-card-actions {
    margin-top: 8px;
    align-items: center;
}

.photo-link-button {
    background: transparent;
    color: #7c3aed !important;
    padding: 0;
    font-weight: 400;
}

.photo-batch-results {
    max-height: 260px;
    overflow-y: auto;
    margin-top: 10px;
}

.photo-batch-result {
    padding: 4px 0;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.photo-lightbox[hidden] {
    display: none;
}

.photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 64px;
}

.photo-lightbox img {
    max-width: 100%;
    max-height: 92vh;
    object-fit: contain;
}

.photo-lightbox-close,
.photo-lightbox-prev,
.photo-lightbox-next {
    position: fixed;
    z-index: 10000;
    width: auto;
    padding: 8px 14px;
    font-size: 32px;
    background: rgba(0,0,0,.55);
}

.photo-lightbox-close { top: 12px; right: 12px; }
.photo-lightbox-prev { left: 10px; top: 48%; }
.photo-lightbox-next { right: 10px; top: 48%; }
body.photo-lightbox-open { overflow: hidden; }

.photo-document-preview {
    text-align: center;
    margin: 15px 0;
}

.photo-document-preview img {
    max-height: 65vh;
    border-radius: 6px;
}

@media (max-width: 900px) {
    .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
    .photo-filter-form { grid-template-columns: 1fr; }
    .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .photo-thumb-button { height: 145px; }
    .photo-toolbar-actions .button,
    .photo-card-actions button { width: auto; }
    .photo-lightbox { padding: 50px 38px; }
}

@media (max-width: 420px) {
    .photo-grid { grid-template-columns: 1fr; }
    .photo-thumb-button { height: 220px; }
}
