:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --border: #e2e8f0;
    --muted: #64748b;
    --accent: #2563eb;
    --accent-2: #38bdf8;
}

body {
    background: radial-gradient(circle at 20% 20%, rgba(37,99,235,0.08), transparent 36%),
                radial-gradient(circle at 80% 0%, rgba(56,189,248,0.12), transparent 34%),
                var(--bg);
    color: #0f172a;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    margin: 0 auto;
    max-width: 1000px;
}

.shell { width: 100%; max-width: 1000px; margin: 0 auto; padding: 18px; }

header { background: var(--card); padding: 16px 18px; border-radius: 14px; border: 1px solid var(--border); box-shadow: 0 14px 40px rgba(0,0,0,0.08); }
header h1 { margin: 0 0 6px; letter-spacing: -0.02em; }
header p { margin: 0 0 10px; color: var(--muted); }

nav { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
nav a, nav .dropbtn { text-decoration: none; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: #f8fafc; color: #0f172a; font-weight: 600; }
nav a:hover, nav .dropbtn:hover { border-color: #cbd5e1; background: #eef2ff; }
.dropdown { position: relative; display: inline-block; }
.dropdown-content { display: none; position: absolute; background: var(--card); min-width: 200px; box-shadow: 0 16px 40px rgba(0,0,0,0.12); border: 1px solid var(--border); border-radius: 10px; padding: 6px 0; z-index: 10; }
.dropdown-content a { display: block; padding: 10px 12px; color: #0f172a; border-radius: 8px; margin: 2px 8px; }
.dropdown-content a:hover { background: #eef2ff; }
.dropdown:hover .dropdown-content { display: block; }

.card { margin-top: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: 0 14px 40px rgba(0,0,0,0.08); }

.search-form form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.search-bar { display: flex; gap: 10px; align-items: center; }
.search-bar input[type="search"] { flex: 1; padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: #f8fafc; font-size: 1rem; }
.search-bar button { padding: 12px 14px; border-radius: 10px; border: none; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; cursor: pointer; box-shadow: 0 12px 28px rgba(37,99,235,0.26); }
.search-bar button:hover { box-shadow: 0 14px 32px rgba(37,99,235,0.32); }
.archived-toggle { align-self: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: #f8fafc; color: #0f172a; font-weight: 700; cursor: pointer; }
.archived-toggle:hover { border-color: #cbd5e1; background: #eef2ff; }

table { width: 100%; border-collapse: collapse; margin-top: 6px; background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: 0 10px 28px rgba(0,0,0,0.06); }
thead { background: #f1f5f9; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; }
th a { color: #0f172a; text-decoration: none; }
th a:hover { color: var(--accent); }
tbody tr:hover { background: #f8fafc; }

.pagination { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.pagination a { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: #f8fafc; text-decoration: none; color: #0f172a; }
.pagination a:hover { border-color: #cbd5e1; background: #eef2ff; }

.status-rezolvat { color: #1565c0; font-weight: 600; }
.status-depasit { color: #c62828; font-weight: 700; }
.status-aproape { color: #f9a825; font-weight: 700; }
.expired { color: red; font-weight: bold; }
.warning { color: orange; }

@media screen and (max-width: 1024px) {
    .container-stampila, .shell { padding: 14px; }
}

/* Mobile table stack */
@media screen and (max-width: 768px) {
    body { padding: 10px; }
    header, .card { padding: 14px; }
    nav { flex-direction: column; align-items: flex-start; }
    .dropdown { width: 100%; }
    .dropdown-content { position: static; box-shadow: none; width: 100%; }

    table, thead, tbody, th, td, tr { display: block; }
    thead tr { position: absolute; top: -9999px; left: -9999px; }
    tr { border: 1px solid #ccc; margin-bottom: 5px; }
    td { border: none; border-bottom: 1px solid #eee; position: relative; padding-left: 50%; text-align: right; }
    td:before { position: absolute; left: 6px; width: 45%; padding-right: 10px; white-space: nowrap; text-align: left; font-weight: bold; }
    td:nth-of-type(1):before { content: "Nr. Intrare"; }
    td:nth-of-type(2):before { content: "Data"; }
    td:nth-of-type(3):before { content: "Expeditor"; }
    td:nth-of-type(4):before { content: "Tip Document"; }
    td:nth-of-type(5):before { content: "Asignat"; }
    td:nth-of-type(6):before { content: "Termen"; }
    td:nth-of-type(7):before { content: "Status"; }
    td:nth-of-type(8):before { content: "Actiuni"; }

    .search-form { display: flex; flex-direction: column; }
    .search-form input[type="search"], .search-form button { width: 100%; margin-bottom: 10px; }
    .pagination { flex-direction: column; align-items: center; }
    .pagination a { margin-bottom: 5px; }
}

@media screen and (max-width: 480px) {
    body { font-size: 14px; }
    h1 { font-size: 1.5rem; }
    td { padding-left: 40%; }
    td:before { width: 35%; }
}
