body {
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1; /* Take remaining space */
}

.login-wrapper .container {
    max-width: 400px;
    min-width: 280px;
    padding: 2rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    background: white;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: auto;
}

.container {
    width: 100%;
    max-width: 1400px; /* Increased max-width for more content */
    min-width: 320px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-sizing: border-box;
    min-height: 0;
    height: auto; /* Allow to grow with content */
}

h1, h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.instance-title {
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.25rem;
}

.status-line {
    text-align: center;
}

input {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

button {
    width: auto;
    padding: 0.6rem;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background-color: #0056b3;
}

.error {
    color: red;
    text-align: center;
    margin-bottom: 1rem;
}

.instance {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 1em;
    background: #fff;
}

.button-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.button-row form {
    display: flex;
    margin: 0;
}

.button-row button {
    width: auto;
    white-space: nowrap;
    min-width: 150px;
}

.view-toggle {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: nowrap;
    margin-left: auto; /* keep the toggle on the right side of the container */
    white-space: nowrap;
}

/* .view-toggle label { */
.view-toggle .view-option {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    flex-shrink: 0;
}

.view-toggle input[type="radio"] {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: #2b7cff; /* modern browsers show colored radio */
}

/* optional: visual active state for label when radio is checked */
.view-toggle input[type="radio"]:checked + span,
.view-toggle input[type="radio"]:checked ~ span {
    font-weight: 600;
    color: #2b7cff;
}

img.qrcode {
    display: block;
    margin: 1rem auto;
    width: 160px;
    height: 160px;
    object-fit: contain;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
}

.instances.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1em;
}

.instances.panel {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

.panel-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1em;
}

@media (max-width: 900px) {
    .panel-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .panel-row, .instances.grid {
        grid-template-columns: 1fr;
    }
}

.excel-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 2em;
    background: #fff;
    font-size: clamp(0.7rem, 2vw, 1.1rem); /* Responsive font size */
}
.excel-grid th, .excel-grid td {
    border: 1.5px solid #b0b0b0; /* Stronger separators */
    padding: 0.5em 0.75em;
    text-align: left;
    min-width: 80px;
    box-sizing: border-box;
}
.excel-grid th {
    background: #f4f4f4;
    font-weight: bold;
}
.excel-grid tr:nth-child(even) {
    background: #f9f9f9;
}
.

 /* Config page styles moved here from templates/config.html */
.config-form {
    max-width: 900px;
    margin: 1.5rem auto;
    padding: 1rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.config-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.config-row label {
    width: 220px;
    font-weight: 600;
}

.config-row input,
.config-row textarea,
.config-row select {
    flex: 1;
    padding: 0.45rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
}

.actions {
    text-align: right;
    margin-top: 1rem;
}

.note {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    text-align: center;
}

/* responsive adjustments */
@media (max-width: 600px) {
    .config-row {
        flex-direction: column;
        align-items: stretch;
    }
    .config-row label {
        width: 100%;
        margin-bottom: 0.25rem;
    }
}

.context-menu {
    position: fixed;
    display: none;
    background: #fff;
    border: 1px solid #d1d1d1;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    padding: 0.35rem 0;
    z-index: 3000;
}

.context-menu button {
    width: 100%;
    padding: 0.55rem 1rem;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 0.95rem;
    color: #222;
    cursor: pointer;
}

.context-menu button:hover {
    background: #eef4ff;
    color: #0b5ed7;
}
