/* =====================================================
   Template layout
   ===================================================== */
:root {
    --tpl-bg: #f6f7f9;
    --tpl-surface: #ffffff;
    --tpl-surface-soft: #f8fafc;
    --tpl-border: rgba(15, 23, 42, 0.08);
    --tpl-border-strong: rgba(15, 23, 42, 0.12);
    --tpl-text: #0f172a;
    --tpl-muted: #64748b;
    --tpl-primary: #175081;
    --tpl-primary-hover: #123e64;
    --tpl-shadow-sm: 0 10px 24px rgba(15, 23, 42, 0.05);
    --tpl-shadow-md: 0 18px 40px rgba(15, 23, 42, 0.08);
    --tpl-shadow-lg: 0 26px 70px rgba(15, 23, 42, 0.10);
    --tpl-max-width: 1280px;

    --app-bg: #f6f7f9;
    --app-surface: #ffffff;
    --app-surface-strong: #ffffff;
    --app-surface-soft: #f8fafc;
    --app-border: rgba(15, 23, 42, 0.08);
    --app-border-strong: rgba(15, 23, 42, 0.12);
    --app-text: #0f172a;
    --app-muted: #64748b;
    --app-primary: #175081;
    --app-primary-hover: #123e64;
    --app-primary-soft: rgba(23, 80, 129, 0.08);
    --app-danger: #d92d20;
    --app-danger-hover: #b42318;
    --app-danger-soft: #fff1f2;
    --app-success-soft: #ecfdf3;
    --app-success-text: #166534;
    --app-warning-soft: #fff7e8;
    --app-warning-text: #9a5b00;
    --app-new-soft: #fee2e2;
    --app-new-text: #991b1b;
    --app-shadow-sm: 0 12px 30px rgba(15, 23, 42, 0.05);
    --app-shadow-md: 0 20px 50px rgba(15, 23, 42, 0.09);
    --app-shadow-lg: 0 26px 70px rgba(15, 23, 42, 0.12);

    --saas-bg: #f6f7f9;
    --saas-surface: #ffffff;
    --saas-surface-strong: #ffffff;
    --saas-border: rgba(15, 23, 42, 0.08);
    --saas-text: #0f172a;
    --saas-muted: #64748b;
    --saas-primary: #175081;
    --saas-primary-hover: #123e64;
    --saas-shadow-lg: 0 24px 70px rgba(15, 23, 42, 0.12);
    --saas-shadow-md: 0 14px 36px rgba(15, 23, 42, 0.08);
    --saas-danger-bg: #fff1f2;
    --saas-danger-border: #fecdd3;
    --saas-danger-text: #9f1239;
}

* {
    box-sizing: border-box;
}

html {
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', Arial, sans-serif;
    background: var(--tpl-bg);
    color: var(--tpl-text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: inherit;
}

button,
input,
textarea,
select {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--tpl-border);
}

.app-header-inner {
    max-width: var(--tpl-max-width);
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    min-width: 0;
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(180deg, #175081, #14446d);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.04em;
    box-shadow: 0 10px 20px rgba(23, 80, 129, 0.18);
    flex-shrink: 0;
}

.brand-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 15px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--tpl-text);
    white-space: nowrap;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--tpl-muted);
    line-height: 1.2;
    margin-top: 2px;
    white-space: nowrap;
}

.app-main {
    flex: 1;
    width: 100%;
}

.app-main-inner {
    max-width: var(--tpl-max-width);
    margin: 0 auto;
    padding: 28px 24px 40px;
}

.content-frame {
    width: 100%;
}

.app-footer {
    border-top: 1px solid var(--tpl-border);
    background: transparent;
}

.app-footer-inner {
    max-width: var(--tpl-max-width);
    margin: 0 auto;
    padding: 18px 24px 28px;
    color: var(--tpl-muted);
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

/* --- Hlavní nadpisy stránek --- */
h1,
h2 {
    text-align: center;
    color: #165081;
    font-weight: bold;
    margin-bottom: 30px;
}

/* --- Formuláře --- */
form {
    max-width: 600px;
    margin: auto;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    box-sizing: border-box;
}

input[type=text],
input[type=email],
textarea {
    width: 100%;
    padding: 12px 15px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: 0.2s all;
}

input[type=text]:focus,
input[type=email]:focus,
textarea:focus {
    border-color: #165081;
    box-shadow: 0 0 5px rgba(22, 80, 129, 0.5);
    outline: none;
}

textarea {
    min-height: 120px;
}

button {
    background-color: #165081;
    color: white;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
    transition: 0.2s all;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

button:hover {
    background-color: #0f3b5c;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

p.message {
    text-align: center;
    color: red;
    font-weight: bold;
    margin-bottom: 20px;
}

/* =====================================================
   Původní portálové prvky
   ===================================================== */
.request-photo-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background-color: #165081;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.request-photo-icon:hover {
    background-color: #0f3b5c;
}

.not-logged-in {
    max-width: 500px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    text-align: center;
}

.not-logged-in input[type=text],
.not-logged-in input[type=email],
.not-logged-in input[type=password] {
    margin-bottom: 12px;
}

.not-logged-in button {
    margin-top: 10px;
}

.g-recaptcha {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.requests-table-full {
    width: 100%;
    overflow-x: auto;
}

.requests-table-full table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.requests-table-full th,
.requests-table-full td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    text-align: left;
    font-size: 0.95rem;
}

.requests-table-full th {
    background-color: #165081;
    color: #fff;
}

.requests-table-full input[type=text],
.requests-table-full textarea {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.9rem;
    box-sizing: border-box;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.requests-table-full button {
    width: 100%;
    padding: 6px 10px;
    font-size: 0.9rem;
    margin: 2px 0;
    border-radius: 6px;
}

/* =====================================================
   Login stránka požadavků
   ===================================================== */
.requests-login-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 8px 0 0;
    background: var(--saas-bg);
}

.requests-login-card {
    position: relative;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--saas-border);
    border-radius: 28px;
    padding: 34px;
    box-shadow: var(--saas-shadow-lg);
}

.login-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(23, 80, 129, 0.08);
    color: var(--saas-primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.requests-login-card h2 {
    margin: 0 0 12px;
    font-size: 34px;
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--saas-text);
}

.requests-login-card p {
    margin: 0;
    color: var(--saas-muted);
    line-height: 1.65;
    font-size: 15px;
    max-width: 560px;
}

.login-message {
    background: var(--saas-danger-bg);
    border: 1px solid var(--saas-danger-border);
    color: var(--saas-danger-text);
    padding: 13px 15px;
    border-radius: 16px;
    margin: 22px 0 0;
    font-weight: 700;
}

.requests-login-form {
    margin-top: 26px;
    display: grid;
    gap: 16px;
}

.login-field {
    display: grid;
    gap: 8px;
}

.login-label {
    font-size: 13px;
    font-weight: 800;
    color: var(--saas-text);
    letter-spacing: 0.01em;
}

.login-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d7e0eb;
    border-radius: 18px;
    padding: 15px 16px;
    font-size: 16px;
    background: #ffffff;
    color: var(--saas-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.login-input:focus {
    outline: none;
    border-color: #8fb4d8;
    box-shadow: 0 0 0 5px rgba(23, 80, 129, 0.10);
    transform: translateY(-1px);
}

.login-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.btn-main,
.btn-ghost {
    border: none;
    border-radius: 16px;
    min-height: 48px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-main {
    background: linear-gradient(180deg, #175081, #14446d);
    color: #fff;
    box-shadow: 0 12px 28px rgba(23, 80, 129, 0.22);
}

.btn-main:hover {
    background: linear-gradient(180deg, #123e64, #103652);
    transform: translateY(-1px);
}

.btn-ghost {
    background: #ffffff;
    color: var(--saas-primary);
    border: 1px solid #d9e5f2;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.btn-ghost:hover {
    background: #f8fafc;
    transform: translateY(-1px);
}

/* =====================================================
   Stránka requests.php
   ===================================================== */
.requests-page {
    position: relative;
    padding: 0;
    background: var(--app-bg);
    min-height: 100vh;
}

.workspace-shell {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 18px;
}

.workspace-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 24px 24px 0;
    flex-wrap: wrap;
}

.workspace-headline {
    min-width: 0;
}

.workspace-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--app-primary-soft);
    color: var(--app-primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.workspace-title {
    margin: 0;
    font-size: 34px;
    line-height: 1.05;
    letter-spacing: -0.035em;
    color: var(--app-text);
    text-align: left;
}

.workspace-subtitle {
    margin: 10px 0 0;
    max-width: 760px;
    color: var(--app-muted);
    font-size: 15px;
    line-height: 1.65;
}

.workspace-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.page-shell {
    position: relative;
    z-index: 1;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--app-border);
    border-radius: 28px;
    box-shadow: var(--app-shadow-lg);
}

.nav-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 0 24px;
    margin-bottom: 18px;
}

.nav-btn,
.toolbar-btn,
.action-btn,
.logout-btn,
.quick-link {
    border: none;
    border-radius: 16px;
    min-height: 44px;
    padding: 11px 16px;
    background: linear-gradient(180deg, #175081, #14446d);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(23, 80, 129, 0.18);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-sizing: border-box;
    width: auto;
}

.nav-btn:hover,
.toolbar-btn:hover,
.action-btn:hover,
.logout-btn:hover,
.quick-link:hover {
    background: linear-gradient(180deg, #123e64, #103652);
    transform: translateY(-1px);
}

.toolbar-btn.toolbar-btn-secondary {
    background: #ffffff;
    color: var(--app-primary);
    border: 1px solid #d7e2ef;
    box-shadow: var(--app-shadow-sm);
}

.toolbar-btn.toolbar-btn-secondary:hover {
    background: #f8fafc;
}

.action-danger,
.logout-btn.logout-danger {
    background: linear-gradient(180deg, #dc3545, #b42331);
    box-shadow: 0 12px 24px rgba(220, 53, 69, 0.18);
}

.action-danger:hover,
.logout-btn.logout-danger:hover {
    background: linear-gradient(180deg, #c62f3f, #a61f2c);
}

.content-stack {
    display: grid;
    gap: 18px;
    padding: 0 24px 24px;
    position: relative;
    z-index: 1;
}

.requests-message {
    display: none;
    padding: 14px 16px;
    border-radius: 18px;
    background: #eef6ff;
    color: #0f3860;
    border: 1px solid #cfe5ff;
    font-weight: 700;
    box-shadow: var(--app-shadow-sm);
}

.requests-message.show {
    display: block;
}

.dashboard-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
}

.dashboard-card {
    background: #ffffff;
    border: 1px solid var(--app-border);
    border-radius: 22px;
    padding: 18px;
    box-shadow: var(--app-shadow-sm);
}

.dashboard-chart-card {
    min-height: 250px;
}

.dashboard-chart-card canvas {
    width: 100% !important;
    height: 180px !important;
}

.dashboard-stat-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    min-height: 250px;
}

.dashboard-kicker {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--app-muted);
    font-weight: 800;
}

.dashboard-number {
    font-size: 44px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--app-text);
}

.avg-time-number {
    color: #15803d;
}

.dashboard-meta {
    color: var(--app-muted);
    font-size: 14px;
    line-height: 1.55;
}

.dashboard-mini-list {
    display: grid;
    gap: 10px;
    margin-top: 6px;
}

.dashboard-mini-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background: #fff;
}

.dashboard-mini-label {
    color: var(--app-muted);
    font-size: 13px;
    font-weight: 700;
}

.dashboard-mini-value {
    color: var(--app-text);
    font-size: 15px;
    font-weight: 900;
}

.table-section {
    display: grid;
    gap: 12px;
}

.table-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.table-section-title {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
    color: var(--app-text);
    letter-spacing: -0.02em;
    text-align: left;
}

.table-section-subtitle {
    margin: 4px 0 0;
    color: var(--app-muted);
    font-size: 14px;
    line-height: 1.55;
}

.requests-table-wrap {
    width: 100%;
    overflow-x: auto;
    background: #ffffff;
    border: 1px solid var(--app-border);
    border-radius: 24px;
    box-shadow: var(--app-shadow-sm);
}

.requests-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1080px;
}

.requests-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--app-muted);
    padding: 16px 14px;
    white-space: nowrap;
    background: #f8fafc;
    border-bottom: 1px solid var(--app-border);
    font-weight: 900;
}

.requests-table tbody td {
    padding: 15px 14px;
    vertical-align: middle;
    background: #ffffff;
    color: var(--app-text);
    border-bottom: 1px solid #edf2f8;
    font-size: 14px;
}

.requests-table tbody tr {
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.requests-table tbody tr:hover td {
    background: #f9fbfe;
}

.requests-table tbody tr:last-child td {
    border-bottom: none;
}

.row-new td:first-child {
    box-shadow: inset 4px 0 0 #b91c1c;
}

.row-progress td:first-child {
    box-shadow: inset 4px 0 0 #f59e0b;
}

.row-done td:first-child {
    box-shadow: inset 4px 0 0 #22c55e;
}

.center {
    text-align: center;
    vertical-align: middle !important;
}

.cell-id {
    width: 84px;
}

.cell-person {
    width: 230px;
}

.cell-title {
    width: 220px;
}

.cell-description {
    width: 300px;
}

.cell-photo {
    width: 88px;
}

.cell-date {
    width: 112px;
}

.cell-status {
    width: 112px;
}

.actions-cell {
    width: 118px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    vertical-align: middle !important;
}

.actions-cell .action-btn {
    width: 100%;
    min-height: 38px;
    padding: 9px 10px;
    font-size: 13px;
}

.id-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    padding: 8px 10px;
    border-radius: 999px;
    background: #eef5fd;
    color: var(--app-primary);
    font-weight: 900;
    font-size: 12px;
    letter-spacing: 0.02em;
}

.person-name {
    font-weight: 800;
    line-height: 1.35;
}

.person-email,
.muted-text,
.time-part {
    color: var(--app-muted);
    font-size: 12px;
}

.person-email {
    margin-top: 4px;
    word-break: break-word;
}

.text-block {
    line-height: 1.55;
    white-space: normal;
    word-break: break-word;
}

.text-strong {
    font-weight: 800;
}

.cell-description .text-block {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    min-width: 88px;
    letter-spacing: 0.01em;
}

.badge-new {
    background: var(--app-new-soft);
    color: var(--app-new-text);
}

.badge-progress {
    background: var(--app-warning-soft);
    color: var(--app-warning-text);
}

.badge-done {
    background: var(--app-success-soft);
    color: var(--app-success-text);
}

.photo-btn {
    border: 1px solid #d7e4f2;
    border-radius: 999px;
    background: #f5f9ff;
    color: var(--app-primary);
    min-width: 52px;
    padding: 7px 10px;
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease;
    width: auto;
    box-shadow: none;
}

.photo-btn:hover {
    background: #ecf4ff;
    transform: translateY(-1px);
    color: var(--app-primary);
    box-shadow: none;
}

.requests-empty {
    background: #ffffff;
    border: 1px solid var(--app-border);
    border-radius: 24px;
    padding: 42px 24px;
    text-align: center;
    color: var(--app-muted);
    box-shadow: var(--app-shadow-sm);
    font-size: 15px;
}

.page-bottom-actions {
    text-align: center;
    margin-top: 4px;
}

.action-btn.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

/* =====================================================
   Stránka create_request.php
   ===================================================== */
.request-create-page {
    background: var(--app-bg);
    min-height: 100%;
}

.form-card {
    background: #ffffff;
    border: 1px solid var(--app-border);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--app-shadow-sm);
}

.form-message {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    font-weight: 700;
    border: 1px solid transparent;
}

.form-message.success {
    background: #ecfdf3;
    color: #166534;
    border-color: #bbf7d0;
}

.form-message.error {
    background: #fff1f2;
    color: #9f1239;
    border-color: #fecdd3;
}

.request-form {
    display: grid;
    gap: 18px;
    max-width: none;
    margin: 0;
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field.full {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 14px;
    font-weight: 800;
    color: var(--app-text);
}

.form-help {
    margin-top: -2px;
    font-size: 13px;
    color: var(--app-muted);
    line-height: 1.5;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    border: 1px solid #d7e0eb;
    background: #fff;
    color: var(--app-text);
    border-radius: 16px;
    padding: 13px 14px;
    font: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #8fb4d8;
    box-shadow: 0 0 0 5px rgba(23, 80, 129, 0.10);
    background: #fff;
}

.form-textarea {
    min-height: 170px;
    resize: vertical;
    line-height: 1.55;
}

.file-upload-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-drop-area {
    width: 100%;
    box-sizing: border-box;
    padding: 22px 18px;
    border: 2px dashed #7aa7d4;
    border-radius: 18px;
    text-align: center;
    cursor: pointer;
    font-weight: 700;
    color: var(--app-primary);
    background: #ffffff;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.file-drop-area.dragover {
    background-color: #f0f7ff;
    border-color: var(--app-primary);
    transform: translateY(-1px);
}

.file-upload-input {
    display: none;
}

.file-names {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-name-item,
.file-preview-placeholder {
    color: var(--app-muted);
    font-size: 14px;
    background: #ffffff;
    border: 1px solid #dbe3ee;
    border-radius: 12px;
    padding: 10px 12px;
}

.file-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.file-preview {
    position: relative;
    width: 108px;
    height: 108px;
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-preview {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #dc2626;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding-top: 6px;
}

.btn {
    border: none;
    border-radius: 16px;
    min-height: 46px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.15s ease, background 0.2s ease, opacity 0.2s ease;
    width: auto;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(180deg, var(--app-primary), #14466f);
    color: #fff;
    box-shadow: 0 8px 18px rgba(23, 80, 129, 0.18);
}

.btn-primary:hover {
    background: linear-gradient(180deg, var(--app-primary-hover), #0c2f4d);
}

.btn-secondary {
    background: #ffffff;
    color: var(--app-primary);
    border: 1px solid #d7e2ef;
    box-shadow: var(--app-shadow-sm);
}

.btn-secondary:hover {
    background: #f8fafc;
}

@media (max-width: 760px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px;
    }
}

@media (max-width: 640px) {
    .form-card {
        padding: 18px;
        border-radius: 20px;
    }
}

/* =====================================================
   Modal požadavku
   ===================================================== */
.action-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    z-index: 100000;
}

.action-modal.is-open {
    display: flex;
}

.action-modal-card {
    width: min(980px, 100%);
    max-height: 90vh;
    overflow: hidden;
    background: #ffffff;
    border-radius: 26px;
    border: 1px solid var(--app-border);
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.22);
    display: flex;
    flex-direction: column;
}

.action-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--app-border);
    background: #f8fafc;
}

.action-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 900;
    color: var(--app-text);
    letter-spacing: -0.02em;
    text-align: left;
}

.action-modal-close {
    border: 1px solid var(--app-border);
    background: #fff;
    color: var(--app-text);
    width: 40px;
    height: 40px;
    border-radius: 999px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--app-shadow-sm);
    padding: 0;
}

.action-modal-body {
    padding: 20px;
    overflow: auto;
}

.action-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.action-tab {
    border: 1px solid #dbe5ef;
    background: #f8fafc;
    color: #334155;
    border-radius: 999px;
    padding: 10px 15px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
    width: auto;
    box-shadow: none;
}

.action-tab:hover {
    transform: translateY(-1px);
    box-shadow: none;
}

.action-tab.is-active {
    background: linear-gradient(180deg, #175081, #14446d);
    color: #fff;
    border-color: #175081;
    box-shadow: 0 12px 22px rgba(23, 80, 129, 0.18);
}

.action-tab-panel {
    display: none;
}

.action-tab-panel.is-active {
    display: block;
}

.action-panel,
.history-panel {
    border: 1px solid var(--app-border);
    border-radius: 22px;
    padding: 18px;
    background: #ffffff;
    box-shadow: var(--app-shadow-sm);
}

.panel-title {
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 900;
    color: var(--app-text);
    letter-spacing: -0.01em;
    text-align: left;
}

.detail-list {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.detail-item {
    font-size: 14px;
    line-height: 1.6;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--app-border);
    background: #fff;
}

.detail-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 900;
    color: var(--app-muted);
    margin-bottom: 4px;
}

.modal-field {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
}

.modal-label {
    font-size: 13px;
    font-weight: 800;
    color: var(--app-text);
}

.modal-select,
.modal-textarea {
    width: 100%;
    border: 1px solid #d7e0eb;
    border-radius: 16px;
    background: #fff;
    color: var(--app-text);
    box-sizing: border-box;
    font: inherit;
    padding: 12px 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.modal-textarea {
    min-height: 132px;
    resize: vertical;
    line-height: 1.55;
}

.modal-select:focus,
.modal-textarea:focus {
    outline: none;
    border-color: #8fb4d8;
    box-shadow: 0 0 0 5px rgba(23, 80, 129, 0.10);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 12px;
}

.modal-btn {
    border: none;
    border-radius: 16px;
    min-height: 44px;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease;
    width: auto;
    box-shadow: none;
}

.modal-btn:hover {
    transform: translateY(-1px);
    box-shadow: none;
}

.modal-btn-primary {
    background: linear-gradient(180deg, #175081, #14446d);
    color: #fff;
    box-shadow: 0 12px 22px rgba(23, 80, 129, 0.16);
}

.modal-btn-primary:hover {
    background: linear-gradient(180deg, #123e64, #103652);
}

.modal-btn-secondary {
    background: #f3f6fa;
    color: #334155;
    border: 1px solid #dde6f0;
}

.modal-btn-secondary:hover {
    background: #eef3f8;
}

.history-empty {
    color: var(--app-muted);
    font-size: 14px;
}

.history-item + .history-item {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #e8eef5;
}

.history-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--app-muted);
}

.history-line {
    margin-top: 6px;
    line-height: 1.55;
    font-size: 14px;
}

.history-label {
    font-weight: 800;
    color: var(--app-muted);
    margin-right: 4px;
}

/* =====================================================
   LIGHTBOX – FOTOGRAFIE POŽADAVKU
   ===================================================== */
.photo-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.photo-lightbox-content {
    background: #fff;
    max-width: 90%;
    max-height: 90%;
    padding: 20px;
    border-radius: 12px;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.photo-lightbox-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #333;
}

.photo-lightbox-close:hover {
    color: #000;
}

#photo-lightbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

#photo-lightbox-grid img {
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

#photo-lightbox-grid img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

/* =====================================================
   Stránka finance.php
   ===================================================== */

.finance-page {
    background: var(--app-bg);
    min-height: 100vh;
}

.finance-page .section-header {
    padding: 18px 20px 0;
}

.finance-page .section-title {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
    color: var(--app-text);
    letter-spacing: -0.02em;
    text-align: left;
}

.finance-page .section-subtitle {
    margin: 6px 0 0;
    color: var(--app-muted);
    font-size: 14px;
    line-height: 1.55;
}

.finance-page .toggle-row {
    display: flex;
    justify-content: flex-start;
}

.finance-page .form-card,
.finance-page .table-card,
.finance-page .chart-box,
.finance-page .fin-card {
    background: #ffffff;
    border: 1px solid var(--app-border);
    border-radius: 24px;
    box-shadow: var(--app-shadow-sm);
}

.finance-page .form-card {
    padding: 20px;
}

.finance-page .table-card {
    overflow: hidden;
}

.finance-page .add-year-form {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    max-width: none;
    margin: 0;
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}

.finance-page .add-year-form input {
    height: 46px;
    padding: 0 14px;
    font-size: 15px;
    min-width: 0;
    border-radius: 14px;
    border: 1px solid #d7e0eb;
    box-sizing: border-box;
    background: #fff;
    color: var(--app-text);
}

.finance-page .add-year-form input:focus {
    outline: none;
    border-color: #8fb4d8;
    box-shadow: 0 0 0 5px rgba(23, 80, 129, 0.10);
}

.finance-page .add-year-form button {
    height: 46px;
    border-radius: 14px;
}

.finance-page .table-wrap {
    width: 100%;
    overflow-x: auto;
    padding: 18px 20px 20px;
    box-sizing: border-box;
}

.finance-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1040px;
    font-size: 14px;
}

.finance-table th,
.finance-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #edf2f8;
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
}

.finance-table th:first-child,
.finance-table td:first-child {
    text-align: left;
}

.finance-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    color: var(--app-muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--app-border);
}

.finance-table tbody tr:hover td {
    background: #f9fbfe;
}

.finance-table tbody tr:last-child td {
    border-bottom: none;
}

.finance-table .year-cell {
    font-weight: 900;
    color: var(--app-text);
}

/* Šířky sloupců ročního přehledu */
.finance-table th:nth-child(1),
.finance-table td:nth-child(1) {
    width: 7%;
}

.finance-table th:nth-child(2),
.finance-table td:nth-child(2),
.finance-table th:nth-child(5),
.finance-table td:nth-child(5),
.finance-table th:nth-child(8),
.finance-table td:nth-child(8) {
    width: 14%;
}

.finance-table th:nth-child(3),
.finance-table td:nth-child(3),
.finance-table th:nth-child(6),
.finance-table td:nth-child(6),
.finance-table th:nth-child(10),
.finance-table td:nth-child(10) {
    width: 8%;
}

.finance-table th:nth-child(4),
.finance-table td:nth-child(4),
.finance-table th:nth-child(7),
.finance-table td:nth-child(7),
.finance-table th:nth-child(9),
.finance-table td:nth-child(9) {
    width: 12%;
}

.finance-table th:nth-child(11),
.finance-table td:nth-child(11) {
    width: 5%;
    text-align: center;
}

.finance-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-top: 1px solid var(--app-border);
    background: var(--app-surface-soft);
    font-weight: 800;
    flex-wrap: wrap;
}

.finance-summary-label {
    font-size: 14px;
    color: var(--app-muted);
}

.finance-summary-value {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -0.01em;
}

.positive {
    color: #15803d;
    font-weight: 800;
}

.negative {
    color: #b91c1c;
    font-weight: 800;
}

.delete-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    text-decoration: none;
    background: linear-gradient(180deg, #dc3545, #b42331);
    color: #fff;
    transition: transform 0.15s ease, background 0.2s ease;
}

.delete-link:hover {
    background: linear-gradient(180deg, #c62f3f, #a61f2c);
    transform: translateY(-1px);
}

.finance-page .fin-dashboard {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.finance-page .fin-card {
    padding: 20px;
}

.finance-page .fin-card.health-good,
.finance-page .fin-card.fond-good {
    border-top: 4px solid #15803d;
}

.finance-page .fin-card.health-mid {
    border-top: 4px solid #f59e0b;
}

.finance-page .fin-card.health-bad,
.finance-page .fin-card.fond-bad {
    border-top: 4px solid #b91c1c;
}

.finance-page .fin-card h3,
.finance-page .chart-box h3 {
    margin: 0 0 14px;
    font-size: 18px;
    font-weight: 900;
    color: var(--app-text);
    letter-spacing: -0.02em;
    text-align: left;
}

.finance-page .fin-card .value {
    font-size: 24px;
    font-weight: 900;
    line-height: 1.1;
}

.finance-page .fin-card small {
    display: block;
    margin-top: 8px;
    color: var(--app-muted);
    font-size: 13px;
    line-height: 1.5;
}

.finance-page .fin-card table {
    width: 100%;
    border-collapse: collapse;
}

.finance-page .fin-card th {
    text-align: left;
    padding: 8px 0;
    font-weight: 700;
    color: var(--app-muted);
    width: 55%;
    border-bottom: 1px solid #edf2f8;
}

.finance-page .fin-card td {
    text-align: right;
    padding: 8px 0;
    border-bottom: 1px solid #edf2f8;
}

.finance-page .fin-card tr:last-child th,
.finance-page .fin-card tr:last-child td {
    border-bottom: none;
}

.finance-page .fond-bar {
    height: 18px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 14px;
}

.finance-page .fond-bar-fill {
    height: 100%;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    border-radius: 999px;
    transition: width 0.5s ease;
}

.finance-page .charts-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.finance-page .chart-box {
    padding: 20px;
}

.finance-page canvas {
    width: 100% !important;
    height: 280px !important;
}

.finance-page .bottom-actions {
    display: flex;
    justify-content: center;
}

@media (max-width: 1180px) {
    .finance-page .fin-dashboard,
    .finance-page .charts-row {
        grid-template-columns: 1fr;
    }

    .finance-page .add-year-form {
        grid-template-columns: 1fr 1fr;
    }

    .finance-page .add-year-form button {
        grid-column: 1 / -1;
    }
}

@media (max-width: 980px) {
    .finance-page .table-wrap {
        padding: 16px;
    }
}

@media (max-width: 640px) {
    .finance-page .add-year-form {
        grid-template-columns: 1fr;
    }

    .finance-page .add-year-form button {
        grid-column: auto;
    }

    .finance-page .form-card,
    .finance-page .fin-card,
    .finance-page .chart-box {
        padding: 18px;
        border-radius: 20px;
    }
}

/* =====================================================
   Responzivní styly
   ===================================================== */
@media (max-width: 1180px) {
    .dashboard-wrap {
        grid-template-columns: 1fr;
    }

    .nav-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .workspace-topbar {
        padding: 20px 20px 0;
    }

    .content-stack {
        padding: 0 20px 20px;
    }

    .page-shell {
        border-radius: 22px;
    }

    .workspace-title {
        font-size: 28px;
    }

    .workspace-controls {
        width: 100%;
        margin-bottom: 8px;
    }

    .toolbar-btn {
        width: 100%;
    }

    .requests-table-wrap {
        background: #ffffff;
        border: none;
        box-shadow: none;
    }

    .cell-description .text-block {
        display: block;
        -webkit-line-clamp: unset;
        -webkit-box-orient: unset;
        overflow: visible;
    }

    .requests-table,
    .requests-table thead,
    .requests-table tbody,
    .requests-table th,
    .requests-table td,
    .requests-table tr {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .requests-table thead {
        display: none;
    }

    .requests-table tbody {
        display: grid;
        gap: 14px;
    }

    .requests-table tbody tr {
        margin-bottom: 0;
        border: 1px solid var(--app-border);
        border-radius: 22px;
        overflow: hidden;
        box-shadow: var(--app-shadow-sm);
        background: #ffffff;
    }

    .requests-table tbody td {
        border-bottom: 1px solid #edf2f7 !important;
        padding: 13px 15px;
        background: transparent !important;
    }

    .requests-table tbody td:last-child {
        border-bottom: none !important;
    }

    .requests-table tbody td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 6px;
        font-size: 11px;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--app-muted);
    }

    .actions-cell {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        width: 100%;
        align-items: stretch;
    }

    .actions-cell::before {
        grid-column: 1 / -1;
    }

    .actions-cell .action-btn {
        width: 100%;
    }
}

@media (max-width: 640px) {
    form,
    .not-logged-in {
        padding: 20px;
    }

    input[type=text],
    input[type=email],
    textarea,
    button {
        font-size: 0.95rem;
    }

    .requests-table-full th,
    .requests-table-full td {
        font-size: 0.85rem;
        padding: 6px;
    }

    .requests-login-card {
        padding: 22px;
        border-radius: 22px;
    }

    .requests-login-card h2 {
        font-size: 28px;
    }

    .login-actions {
        flex-direction: column;
    }

    .btn-main,
    .btn-ghost {
        width: 100%;
    }

    .workspace-topbar {
        padding: 18px 18px 0;
    }

    .content-stack {
        padding: 0 18px 18px;
    }

    .workspace-title {
        font-size: 24px;
    }

    .nav-grid {
        grid-template-columns: 1fr;
        padding: 0 18px;
    }

    .dashboard-number,
    .avg-time-number {
        font-size: 36px;
    }

    .actions-cell {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-btn {
        width: 100%;
    }

    .action-tabs {
        flex-direction: column;
    }
}

@media (max-width: 400px) {
    form,
    .not-logged-in {
        padding: 15px;
    }

    button {
        padding: 12px 15px;
    }
}