/* ============================================================
   EOD v2 - standalone stylesheet (bez CDN, bez Tailwind)
   ============================================================ */

/* ===== Reset & base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1e293b;
    background: #f1f5f9;
    min-height: 100vh;
}
h1, h2, h3, h4, h5 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.5rem; margin-bottom: 1rem; }
h2 { font-size: 1.25rem; margin-top: 0; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
small { font-size: .8em; }
.muted { color: #64748b; }

/* ===== Layout ===== */
.container { max-width: 1280px; margin: 0 auto; padding: 0 1rem; }
.main { padding: 1.5rem 1rem; }

.app-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.header-inner {
    display: flex; align-items: center; gap: 1rem;
    padding: .75rem 1rem; flex-wrap: wrap;
}
.brand { color: white; font-size: 1.25rem; font-weight: 700; text-decoration: none; }
.brand .ver { font-size: .7rem; font-weight: 400; opacity: .7; }
.nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.nav-link {
    color: rgba(255,255,255,.9); padding: .375rem .75rem;
    border-radius: .375rem; font-size: .9rem; text-decoration: none;
    transition: background .15s;
}
.nav-link:hover { background: rgba(255,255,255,.15); color: white; text-decoration: none; }
.user-box { display: flex; align-items: center; gap: .75rem; }
.user-name {
    color: rgba(255,255,255,.95); font-size: .85rem;
    padding: .25rem .5rem; border-radius: .25rem;
    background: rgba(255,255,255,.1); text-decoration: none;
}
.user-name:hover { background: rgba(255,255,255,.2); color: white; text-decoration: none; }

.app-footer {
    text-align: center; font-size: .75rem; color: #64748b;
    padding: 1rem; margin-top: 2rem; border-top: 1px solid #e2e8f0; background: white;
}

/* ===== Banner ===== */
.banner { padding: .625rem 0; font-size: .9rem; }
.banner-warning { background: #fef3c7; color: #92400e; border-bottom: 2px solid #f59e0b; }
.banner a { color: inherit; text-decoration: underline; font-weight: 600; }

/* ===== Card ===== */
.card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: .5rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.card h2:first-child, .card h3:first-child { margin-top: 0; }

/* ===== Page header ===== */
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap;
}
.page-head h1, .page-head h2 { margin: 0; }

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: .5rem 1rem;
    border-radius: .375rem;
    border: 1px solid transparent;
    background: #e2e8f0; color: #1e293b;
    font-size: .9rem; font-weight: 500;
    cursor: pointer; text-decoration: none;
    line-height: 1.2;
    transition: background .15s, border-color .15s;
}
.btn:hover { background: #cbd5e1; text-decoration: none; }
.btn-sm { padding: .35rem .65rem; font-size: .825rem; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover { background: #1d4ed8; color: white; }
.btn-secondary { background: #475569; color: white; }
.btn-secondary:hover { background: #334155; color: white; }
.btn-warning { background: #f59e0b; color: white; }
.btn-warning:hover { background: #d97706; color: white; }
.btn-success { background: #10b981; color: white; }
.btn-success:hover { background: #059669; color: white; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; color: white; }
.btn-link {
    background: transparent; color: #2563eb; padding: .25rem .5rem;
    border: none;
}
.btn-link:hover { background: transparent; text-decoration: underline; color: #1d4ed8; }
.btn-danger-link { color: #dc2626; }
.btn-danger-link:hover { color: #b91c1c; }

/* ===== Forms ===== */
.form label, .form > label {
    display: block; margin-bottom: .75rem; font-weight: 500; font-size: .85rem;
}
.form input[type="text"],
.form input[type="email"],
.form input[type="password"],
.form input[type="number"],
.form input[type="date"],
.form input[type="file"],
.form input:not([type]),
.form select,
.form textarea {
    display: block; width: 100%;
    padding: .5rem .65rem; margin-top: .25rem;
    border: 1px solid #cbd5e1; border-radius: .375rem;
    font-size: .9rem; font-family: inherit;
    background: white;
}
.form input:focus, .form select:focus, .form textarea:focus {
    outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form input[type="checkbox"] { display: inline-block; width: auto; margin-right: .25rem; vertical-align: middle; }
.form textarea { min-height: 4em; font-family: inherit; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.form-row > label { margin-bottom: .75rem; }
.form-actions { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.form-inline, .inline { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.form-inline label { margin: 0; flex: 1; min-width: 120px; }
.inline-edit { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.inline-edit label { flex: 1; margin: 0; }

/* Filters bar */
.filters {
    display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
    margin-bottom: 1rem; padding: .75rem; background: white;
    border: 1px solid #e2e8f0; border-radius: .5rem;
}
.filters input, .filters select {
    padding: .4rem .6rem; border: 1px solid #cbd5e1; border-radius: .25rem;
    font-size: .875rem;
}
.filters input { flex: 1; min-width: 180px; }

/* ===== Table ===== */
.table { width: 100%; border-collapse: collapse; background: white; }
.table th, .table td {
    text-align: left; padding: .6rem .75rem; border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}
.table th { background: #f8fafc; font-weight: 600; font-size: .8rem; color: #475569; text-transform: uppercase; letter-spacing: .03em; }
.table tbody tr:hover { background: #f8fafc; }
.table-sm th, .table-sm td { padding: .4rem .55rem; font-size: .85rem; }

/* ===== Badge ===== */
.badge {
    display: inline-block; padding: .15rem .5rem; border-radius: .25rem;
    background: #e2e8f0; color: #475569; font-size: .7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .03em;
}
.badge-zwykla        { background: #dbeafe; color: #1e40af; }
.badge-kopia         { background: #fef3c7; color: #92400e; }
.badge-udostepniona  { background: #f3e8ff; color: #6b21a8; }
.badge-wewnetrzna    { background: #d1fae5; color: #065f46; }
.badge-aktywna       { background: #d1fae5; color: #065f46; }
.badge-zakonczona    { background: #e2e8f0; color: #475569; }
.badge-niepodjete    { background: #fee2e2; color: #991b1b; }
.badge-w_realizacji  { background: #dbeafe; color: #1e40af; }
.badge-zakonczone    { background: #d1fae5; color: #065f46; }
.badge-anulowane     { background: #e2e8f0; color: #475569; }
.badge-success       { background: #d1fae5; color: #065f46; }
.badge-pilne         { background: #dc2626; color: white; }
.badge-perm          { background: #ede9fe; color: #5b21b6; margin: 1px; }
.badge-zaakceptowany { background: #d1fae5; color: #065f46; }
.badge-odrzucony     { background: #fee2e2; color: #991b1b; }
.badge-podpisany     { background: #d1fae5; color: #065f46; }
.badge-odmowa        { background: #fee2e2; color: #991b1b; }
.badge-zwrot_do_poprawy { background: #fef3c7; color: #92400e; }

/* ===== Lists ===== */
.list { list-style: none; padding: 0; margin: 0; }
.list > li {
    padding: .55rem 0; border-bottom: 1px solid #f1f5f9;
    display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
}
.list > li:last-child { border-bottom: none; }

/* ===== Tiles (pulpit) ===== */
.tiles {
    display: grid; gap: .75rem; margin-bottom: 1.25rem;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.tile {
    background: white; border: 1px solid #e2e8f0; border-radius: .5rem;
    padding: 1rem; text-decoration: none; color: #1e293b;
    transition: box-shadow .15s, transform .1s;
    display: flex; flex-direction: column; gap: .25rem;
}
.tile:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); transform: translateY(-1px); text-decoration: none; }
.tile-label { font-weight: 600; font-size: .95rem; }
.tile-desc { font-size: .75rem; color: #64748b; }
.tile-warning { border-color: #f59e0b; background: #fffbeb; }
.tile-accent { border-color: #2563eb; background: #eff6ff; }

/* ===== Skok form ===== */
.skok-card { background: #eff6ff; border-color: #bfdbfe; }
.skok-form {
    display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem;
}
.skok-form input {
    flex: 1; min-width: 250px;
    padding: .5rem .75rem; border: 1px solid #cbd5e1; border-radius: .375rem; font-size: .95rem;
}
.skok-form label { font-size: .9rem; }

/* ===== Grid ===== */
.grid-2 {
    display: grid; gap: 1rem;
    grid-template-columns: 1fr;
}
@media (min-width: 768px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Actions row ===== */
.actions { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }

/* ===== Doc item (zadania) ===== */
.doc-item {
    padding: 1rem; border: 1px solid #e2e8f0; border-radius: .5rem;
    margin-bottom: 1rem; background: #f8fafc;
}
.doc-item h3 { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-top: 0; }

/* ===== Permissions grid ===== */
.perm-grid {
    display: grid; gap: .5rem; margin-bottom: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.perm-row {
    display: flex; gap: .5rem; padding: .65rem; border: 1px solid #e2e8f0;
    border-radius: .375rem; background: #f8fafc; cursor: pointer; font-weight: normal;
}
.perm-row:hover { background: #f1f5f9; }
.perm-row input { margin-top: .25rem; }
.perm-row strong { display: block; font-size: .85rem; color: #1e293b; }
.perm-row small { display: block; color: #64748b; margin-top: .25rem; font-size: .75rem; }

/* ===== Alerts ===== */
.alert { padding: .65rem .9rem; border-radius: .375rem; margin-bottom: 1rem; font-size: .9rem; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }

/* ===== Login ===== */
.login-body { background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%); min-height: 100vh; display: flex; align-items: center; }
.login-box {
    background: white; max-width: 380px; margin: 0 auto; padding: 2rem;
    border-radius: .75rem; box-shadow: 0 25px 50px -12px rgba(0,0,0,.25); width: 100%;
}
.login-box h1 { text-align: center; color: #1e3a8a; margin-bottom: .25rem; }
.login-box > p.muted { text-align: center; margin-bottom: 1.5rem; }
.login-box label { display: block; margin-bottom: 1rem; font-size: .85rem; font-weight: 500; }
.login-box input {
    display: block; width: 100%; margin-top: .25rem;
    padding: .55rem .75rem; border: 1px solid #cbd5e1; border-radius: .375rem; font-size: .95rem;
}
.login-box input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

/* ===== Print ===== */
@media print {
    .app-header, .app-footer, .btn, .filters, .banner { display: none !important; }
    body { background: white; }
    .card { border: none; box-shadow: none; padding: 0; }
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .header-inner { flex-direction: column; align-items: flex-start; }
    .nav { width: 100%; }
    .table { font-size: .85rem; }
    .table th, .table td { padding: .4rem .5rem; }
}
