* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Tahoma, Arial, sans-serif;
    background: #f4f6f9;
    color: #1f2937;
    direction: rtl;
}

a {
    color: inherit;
    text-decoration: none;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #0f172a, #1e3a8a);
}

.login-card {
    width: min(420px, calc(100% - 32px));
    background: #fff;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 22px;
}

.login-card p {
    margin: 0 0 22px;
    color: #64748b;
}

label {
    display: block;
    margin-bottom: 14px;
}

label span {
    display: block;
    margin-bottom: 7px;
    font-weight: 700;
    font-size: 13px;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid #d7dde8;
    background: #fff;
    color: #111827;
    border-radius: 12px;
    padding: 11px 12px;
    font: inherit;
    outline: none;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

button {
    border: 0;
    border-radius: 12px;
    background: #1d4ed8;
    color: #fff;
    padding: 12px 18px;
    cursor: pointer;
    font-weight: 700;
}

button:hover {
    background: #1e40af;
}

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

.sidebar {
    width: 260px;
    background: #0f172a;
    color: #fff;
    padding: 20px;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    overflow: auto;
}

.brand {
    padding: 14px;
    background: rgba(255,255,255,.08);
    border-radius: 16px;
    margin-bottom: 18px;
}

.brand strong,
.brand span {
    display: block;
}

.brand span {
    margin-top: 6px;
    color: #cbd5e1;
    font-size: 13px;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar nav a {
    padding: 12px 14px;
    border-radius: 12px;
    color: #e5e7eb;
}

.sidebar nav a:hover {
    background: rgba(255,255,255,.08);
}

.main {
    margin-right: 260px;
    width: calc(100% - 260px);
}

.topbar {
    height: 70px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar small {
    display: block;
    color: #64748b;
    margin-top: 4px;
}

.content {
    padding: 24px;
}

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

.card,
.panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(15,23,42,.04);
}

.card {
    padding: 20px;
}

.card span {
    color: #64748b;
    font-size: 13px;
}

.card strong {
    display: block;
    margin-top: 8px;
    font-size: 28px;
}

.panel {
    padding: 22px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.panel h1 {
    font-size: 22px;
    margin: 0 0 20px;
}

.panel h2 {
    font-size: 18px;
    margin: 24px 0 14px;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: right;
    font-size: 14px;
}

th {
    background: #f8fafc;
    color: #334155;
}

.badge {
    display: inline-flex;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 12px;
    font-weight: 700;
}

.alert {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
}

@media (max-width: 900px) {
    .sidebar {
        position: relative;
        width: 100%;
        bottom: auto;
    }

    .layout {
        display: block;
    }

    .main {
        margin-right: 0;
        width: 100%;
    }

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

    .content {
        padding: 14px;
    }
}

.page-actions {
    margin-bottom: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #1d4ed8;
    color: #fff;
    border-radius: 10px;
    padding: 9px 14px;
    font-weight: 700;
    font-size: 13px;
}

.btn.small {
    padding: 6px 10px;
    font-size: 12px;
}

.btn.light {
    background: #e2e8f0;
    color: #0f172a;
}

.inline-form {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.inline-form select,
.inline-form input {
    width: auto;
    min-width: 220px;
}

.mini-form {
    margin: 0;
}

button.danger {
    background: #dc2626;
    padding: 7px 10px;
    font-size: 12px;
}

button.danger:hover {
    background: #b91c1c;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 28px;
}

.check-row input {
    width: auto;
}

.comment-list {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.comment-item {
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 14px;
    padding: 14px;
}

.comment-item strong {
    display: inline-block;
    margin-left: 10px;
}

.comment-item small {
    color: #64748b;
}

.comment-item p {
    margin: 10px 0 0;
    line-height: 1.9;
}

.badge.status-critical,
.badge.status-needs_fix {
    background: #fee2e2;
    color: #991b1b;
}

.badge.status-doing {
    background: #dbeafe;
    color: #1e40af;
}

.badge.status-testing {
    background: #fef3c7;
    color: #92400e;
}

.badge.status-done,
.badge.status-published {
    background: #dcfce7;
    color: #166534;
}

.page-actions {
    margin-bottom: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #1d4ed8;
    color: #fff;
    border-radius: 10px;
    padding: 9px 14px;
    font-weight: 700;
    font-size: 13px;
}

.btn.small {
    padding: 6px 10px;
    font-size: 12px;
}

.btn.light {
    background: #e2e8f0;
    color: #0f172a;
}

.inline-form {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.inline-form select,
.inline-form input {
    width: auto;
    min-width: 220px;
}

.mini-form {
    margin: 0;
}

button.danger {
    background: #dc2626;
    padding: 7px 10px;
    font-size: 12px;
}

button.danger:hover {
    background: #b91c1c;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 28px;
}

.check-row input {
    width: auto;
}

.comment-list {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.comment-item {
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 14px;
    padding: 14px;
}

.comment-item strong {
    display: inline-block;
    margin-left: 10px;
}

.comment-item small {
    color: #64748b;
}

.comment-item p {
    margin: 10px 0 0;
    line-height: 1.9;
}

.badge.status-critical,
.badge.status-needs_fix {
    background: #fee2e2;
    color: #991b1b;
}

.badge.status-doing {
    background: #dbeafe;
    color: #1e40af;
}

.badge.status-testing {
    background: #fef3c7;
    color: #92400e;
}

.badge.status-done,
.badge.status-published {
    background: #dcfce7;
    color: #166534;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.info-grid div {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px;
}

.info-grid span {
    display: block;
    color: #64748b;
    font-size: 12px;
    margin-bottom: 8px;
}

.info-grid strong {
    display: block;
    color: #0f172a;
    font-size: 14px;
    min-height: 22px;
}

.text-box {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px;
    line-height: 2;
    min-height: 52px;
}

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

.totals-box {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.totals-box div {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px;
}

.totals-box span {
    display: block;
    color: #64748b;
    font-size: 12px;
    margin-bottom: 8px;
}

.totals-box strong {
    display: block;
    font-size: 16px;
    color: #0f172a;
}

@media print {
    .sidebar,
    .topbar,
    .page-actions,
    .panel:not(.printable-document) {
        display: none !important;
    }

    .main {
        margin: 0 !important;
        width: 100% !important;
    }

    .content {
        padding: 0 !important;
    }

    .printable-document {
        box-shadow: none !important;
        border: 0 !important;
    }
}

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