body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f2f5;
    box-sizing: border-box;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.login-card h1 {
    text-align: center;
    color: #212121;
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.login-card p.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #333;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fcfcfc;
}

.input-wrapper .icon {
    position: absolute;
    left: 15px;
    color: #999;
    width: 18px;
    height: 18px;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: #333;
    border-radius: 8px;
    outline: none;
}

.input-wrapper input:focus {
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.input-wrapper .toggle-password {
    position: absolute;
    right: 15px;
    cursor: pointer;
    color: #999;
    width: 18px;
    height: 18px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-bottom: 20px;
}

.btn-primary:hover {
    background-color: #218838;
}

.forgot-password {
    text-align: center;
    margin-bottom: 30px;
}

.forgot-password a {
    color: #007bff;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.forgot-password a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.divider {
    border-top: 1px solid #eee;
    margin: 30px 0;
}

.demo-info {
    text-align: center;
    color: #777;
    font-size: 0.85rem;
}

.error-message {
    color: #dc3545;
    text-align: center;
    margin-bottom: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.dashboard-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-self: baseline;
}

.dashboard-header {
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
}

.header-subtitle {
    font-size: 0.9rem;
    color: #666;
    margin-top: 4px;
}

.logout-link {
    display: flex;
    align-items: center;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    transition: background 0.2s;
    white-space: nowrap;
}

.logout-link:hover {
    background: #f9f9f9;
}

.filter-panel {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    width: 100%; 
    box-sizing: border-box;
}

.search-bar {
    position: relative;
    margin-bottom: 15px;
}

.search-bar input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    background-color: #f5f5f7;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #333;
    outline: none;
    box-sizing: border-box;
}

.search-bar .icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    width: 18px;
    height: 18px;
}

.filter-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-select {
    width: 100%;
    padding: 12px 15px;
    background-color: #f5f5f7;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #333;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    cursor: pointer;
}

.company-section {
    width: 100%;
    margin-bottom: 15px;
}

.company-summary {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    list-style: none;
    transition: background 0.2s;
    position: relative;
    z-index: 2;
}
.company-summary::-webkit-details-marker { display: none; }

.company-summary:hover {
    background-color: #fafafa;
}

.company-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.company-icon {
    color: #333;
    width: 24px;
    height: 24px;
}

.company-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: #111;
}

.company-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.doc-count {
    font-size: 0.9rem;
    color: #28a745;
    font-weight: 600;
}

.chevron {
    color: #333;
    width: 20px;
    height: 20px;
    transition: transform 0.2s;
}

details[open] .chevron {
    transform: rotate(180deg);
}

details[open] .company-summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: 1px solid #f0f0f0;
}

.company-content {
    background: white;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    padding: 20px; 
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    margin-top: -1px;
}

.document-card {
    background: #f5f5f7;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.1s, box-shadow 0.1s;
    border: 1px solid transparent;
    margin-bottom: 10px;
}

.document-card:first-child {
    margin-top: 15px;
}

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

.document-card:hover {
    background: #fff;
    border-color: #ddd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.doc-icon { color: #666; min-width: 24px; }
.doc-details { flex-grow: 1; overflow: hidden; }
.doc-title { font-weight: 600; font-size: 0.95rem; color: #111; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-subtitle { font-size: 0.85rem; color: #666; }
.doc-meta { text-align: right; min-width: 80px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.doc-amount { font-weight: 700; font-size: 0.95rem; color: #111; }
.doc-date { font-size: 0.75rem; color: #888; }
.badge { font-size: 0.75rem; padding: 4px 8px; border-radius: 6px; font-weight: 600; }
.badge.pending { background-color: #fff8e1; color: #8d6e03; border: 1px solid #faeab8; }
.badge.confirmed, .badge.signed { background-color: #e6f9ed; color: #1e7e34; border: 1px solid #d1e7dd; }
.badge.rejected { background-color: #ffeef0; color: #dc3545; border: 1px solid #f5c6cb; }
.badge.paid { background-color: #ffffff; color: #313131; border: 1px solid #d1e7dd; }

/* --- Стили для детальной страницы документа --- */
.doc-page-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    align-self: baseline;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #333;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.2s;
}

.back-btn:hover {
    background: #f5f5f7;
}


.doc-detail-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    background: #f5f5f7; 
    border: 1px solid #eee;
}

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

.doc-header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #111;
    line-height: 1.3;
}

.doc-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

@media (min-width: 600px) {
    .doc-grid-top {
        grid-template-columns: 1fr 1fr;
    }
}

.field-block label {
    display: block;
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.field-block .value {
    font-size: 1.1rem;
    color: #111;
    font-weight: 500;
    line-height: 1.4;
}

.field-block .value.large-amount {
    font-weight: 700;
}

.comment-section {
    margin-top: 20px;
    margin-bottom: 20px;
    border-top: 1px solid #e0e0e0;
    padding-top: 20px;
}

.comment-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f0f0f2;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    outline: none;
    box-sizing: border-box;
    height: 50px; 
    transition: all 0.2s;
}

.comment-input:focus {
    background: white;
    border-color: #bbb;
    height: 80px;
}

.actions-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 600px) {
    .actions-row {
        flex-direction: row;
    }
}

.btn-action {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    text-align: center;
}

.btn-action:hover {
    opacity: 0.9;
}

.btn-sign {
    background-color: #008751;
    color: white;
}

.btn-reject {
    background-color: #ee312d;
    color: white;
}

.doc-status-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* --- История согласования --- */
.signatures-list {
    margin-top: 30px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.signatures-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.signature-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 10px;
}

.sig-avatar {
    width: 40px;
    height: 40px;
    background: #e9ecef;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-weight: 600;
    font-size: 0.9rem;
}

.sig-content {
    flex: 1;
}

.sig-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.sig-name {
    font-weight: 600;
    color: #111;
    font-size: 0.95rem;
}

.sig-role {
    font-size: 0.8rem;
    color: #888;
    margin-left: 8px;
    font-weight: 400;
}

.sig-date {
    font-size: 0.8rem;
    color: #999;
}

.sig-comment {
    font-size: 0.9rem;
    color: #555;
    margin-top: 6px;
    background: #fafafa;
    padding: 8px;
    border-radius: 6px;
}

.sig-result {
    font-size: 0.8rem;
    font-weight: 600;
}
.sig-result.approved { color: #28a745; }
.sig-result.rejected { color: #dc3545; }
.sig-result.paid { color: #313131; }
.already-signed-msg {
    background: #e6f9ed;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    margin-top: 20px;
    border: 1px solid #d4edda;
}