* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f4f4;
    color: #222;
}

a {
    color: #064f8f;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9eef3;
}

.login-box {
    width: 360px;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    padding: 24px;
    border-radius: 8px;
}

.login-box h1 {
    margin-top: 0;
    font-size: 24px;
}

label {
    display: block;
    margin-top: 14px;
    margin-bottom: 5px;
    font-weight: bold;
}

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #b8b8b8;
    border-radius: 4px;
    background: #fff;
}

button {
    margin-top: 18px;
    padding: 9px 16px;
    border: 0;
    border-radius: 4px;
    background: #333;
    color: #fff;
    cursor: pointer;
}

button:hover {
    background: #000;
}

.error-box {
    padding: 10px;
    background: #f8d7da;
    border: 1px solid #e0aeb4;
    color: #842029;
    margin-bottom: 14px;
    border-radius: 4px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #222;
    color: #fff;
    padding: 12px 20px;
}

.topbar a {
    color: #fff;
    margin-left: 16px;
}

.container {
    max-width: 1180px;
    margin: 24px auto;
    padding: 0 20px;
}

.muted {
    color: #666;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin: 24px 0;
}

.stat-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 16px;
}

.stat-card span {
    display: block;
    color: #666;
    margin-bottom: 8px;
}

.stat-card strong {
    font-size: 28px;
}

.panel {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 18px;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 9px;
    border-bottom: 1px solid #ddd;
    text-align: left;
}

th {
    background: #f0f0f0;
}

.success-box {
    padding: 10px;
    background: #d1e7dd;
    border: 1px solid #badbcc;
    color: #0f5132;
    margin-bottom: 14px;
    border-radius: 4px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.button-secondary {
    display: inline-block;
    margin-left: 10px;
    padding: 9px 16px;
    border-radius: 4px;
    background: #666;
    color: #fff;
    text-decoration: none;
}

.button-secondary:hover {
    background: #444;
    text-decoration: none;
}

.actions {
    white-space: nowrap;
}

.actions a {
    margin-right: 10px;
}

.inline-form {
    display: inline;
}

.link-button {
    margin: 0 10px 0 0;
    padding: 0;
    border: 0;
    background: none;
    color: #064f8f;
    cursor: pointer;
    font: inherit;
}

.link-button:hover {
    text-decoration: underline;
    background: none;
}

.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin: 16px 0;
}

.checkbox-row label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
}

.checkbox-row input[type="checkbox"] {
    width: auto;
}

.layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.layout-grid label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
}

.layout-grid input[type="checkbox"] {
    width: auto;
}

.small-text {
    font-size: 12px;
    color: #555;
}

code {
    background: #f1f1f1;
    padding: 2px 4px;
    border-radius: 3px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
}

.button-primary {
    display: inline-block;
    padding: 9px 16px;
    border-radius: 4px;
    background: #333;
    color: #fff;
    text-decoration: none;
}

.button-primary:hover {
    background: #000;
    text-decoration: none;
}

.stock-badge {
    display: inline-block;
    min-width: 36px;
    padding: 3px 8px;
    border-radius: 999px;
    text-align: center;
    font-weight: bold;
}

.stock-ok {
    background: #d1e7dd;
    color: #0f5132;
}

.stock-low {
    background: #fff3cd;
    color: #664d03;
}

.stock-empty {
    background: #f8d7da;
    color: #842029;
}

.dynamic-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.dynamic-field {
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
}

.required-marker {
    color: #842029;
    font-weight: bold;
}

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
}

.inline-check input[type="checkbox"] {
    width: auto;
}

.multi-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.multi-options label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    margin: 0;
}

.multi-options input[type="checkbox"] {
    width: auto;
}

.attachment-summary {
    margin-top: 18px;
    padding: 14px;
    border: 1px solid #ddd;
    background: #fafafa;
    border-radius: 6px;
}

.attachment-summary h4 {
    margin-top: 0;
}

.attachment-summary ul {
    margin-top: 4px;
}

.media-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.media-card {
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 6px;
    padding: 14px;
}

.media-card-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.media-id {
    color: #666;
    font-size: 13px;
    white-space: nowrap;
}

.media-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 6px 14px;
    font-size: 14px;
}

.media-details {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.media-details summary {
    cursor: pointer;
    font-weight: bold;
    color: #064f8f;
}

.media-details form {
    margin-top: 10px;
}