/* BeonLegal Admin — тема легализации, сдержанная и аккуратная */
:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --sidebar-bg: #1a2332;
    --sidebar-text: #e2e6eb;
    --sidebar-active: #2d3d52;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --error: #dc2626;
    --status-done: #059669;
    --status-hold: #d97706;
    --status-pending: #6366f1;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    --font: "DM Sans", "Segoe UI", system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
    font-family: var(--font);
    font-size: 15px;
    color: var(--text);
    background: var(--bg);
}

#app {
    height: 100%;
}

/* Layout */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: #fff;
    text-decoration: none;
    padding: 0 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: 1rem;
}

.sidebar nav {
    flex: 1;
    padding: 0 .5rem;
}

.nav-link {
    display: block;
    padding: .6rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    margin: 0 .25rem;
}

.nav-link:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
}

.sidebar-footer {
    padding: 1rem 1.25rem 0;
    border-top: 1px solid rgba(255,255,255,.08);
}

.logout-btn {
    color: var(--sidebar-text);
    width: 100%;
    justify-content: center;
}

.logout-btn:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

.main {
    flex: 1;
    padding: 2rem 2.5rem;
    overflow: auto;
}

/* Page */
.page {
    max-width: 960px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: .5rem;
}

.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: .9rem;
}

.back-link:hover {
    color: var(--primary);
}

.case-status-badge {
    display: inline-block;
    padding: .25rem .6rem;
    border-radius: 6px;
    font-size: .8rem;
    font-weight: 500;
}

.case-status-badge[data-status="active"] { background: #dbeafe; color: var(--primary); }
.case-status-badge[data-status="done"]   { background: #d1fae5; color: var(--status-done); }
.case-status-badge[data-status="hold"]   { background: #fef3c7; color: var(--status-hold); }
.case-status-badge[data-status="pending"] { background: #e0e7ff; color: var(--status-pending); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1rem;
    font-size: .9rem;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.btn:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--border);
    color: var(--text);
}

.btn-sm {
    padding: .25rem .5rem;
    font-size: .85rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: .35rem;
    font-weight: 500;
    font-size: .9rem;
}

.input {
    width: 100%;
    padding: .6rem .75rem;
    font-size: .95rem;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.input.select {
    cursor: pointer;
    max-width: 12rem;
}

.validation-message, .error-msg {
    font-size: .85rem;
    color: var(--error);
    margin-top: .25rem;
}

/* Login page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #1a2332 0%, #2d3d52 100%);
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 360px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
    padding: 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-header h1 {
    margin: 0 0 .35rem;
    font-size: 1.5rem;
    color: var(--text);
}

.login-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: .9rem;
}

.login-card .btn-primary {
    width: 100%;
    margin-top: .5rem;
    padding: .7rem;
}

.form-footer {
    margin-top: 1rem;
    text-align: center;
}

.form-footer a {
    color: var(--primary);
    font-size: .9rem;
}

.success-msg {
    font-size: .85rem;
    color: var(--status-done);
    margin-top: .25rem;
}

.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.data-table th,
.data-table td {
    padding: .6rem .75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: .8rem;
    text-transform: uppercase;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Cases grid */
.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.case-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: box-shadow .15s, border-color .15s;
}

.case-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    border-color: #cbd5e1;
}

.case-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .5rem;
    margin-bottom: .5rem;
}

.case-person {
    font-weight: 600;
    font-size: 1.05rem;
}

.case-status {
    flex-shrink: 0;
    padding: .2rem .5rem;
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 500;
}

.case-status[data-status="active"] { background: #dbeafe; color: var(--primary); }
.case-status[data-status="done"]   { background: #d1fae5; color: var(--status-done); }
.case-status[data-status="hold"]   { background: #fef3c7; color: var(--status-hold); }
.case-status[data-status="pending"] { background: #e0e7ff; color: var(--status-pending); }

.case-meta {
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: .5rem;
}

.case-desc {
    margin: 0;
    font-size: .9rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

.empty-state p {
    margin: 0 0 1rem;
    color: var(--text-muted);
}

.loading {
    color: var(--text-muted);
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
    padding: 1.75rem;
    width: 100%;
    max-width: 420px;
}

.modal h2 {
    margin: 0 0 1.25rem;
    font-size: 1.2rem;
}

.modal-actions {
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
    margin-top: 1.25rem;
}

/* Case detail */
.detail-grid {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.detail-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.detail-card h2 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.detail-card dl {
    margin: 0;
    display: grid;
    gap: .6rem;
}

.detail-card dt {
    font-size: .8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0;
}

.detail-card dd {
    margin: 0 0 .25rem;
    font-size: .95rem;
}

.detail-card dd.desc {
    white-space: pre-wrap;
}

/* Documents */
.upload-area {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: .9rem;
    margin-bottom: 1rem;
}

.input-file {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
}

.doc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.doc-list li {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border);
}

.doc-list li:last-child {
    border-bottom: none;
}

.doc-list a {
    color: var(--primary);
    text-decoration: none;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-list a:hover {
    text-decoration: underline;
}

.doc-meta {
    font-size: .8rem;
    color: var(--text-muted);
}

.no-docs {
    margin: 0;
    color: var(--text-muted);
    font-size: .9rem;
}

/* Blazor defaults */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}
