[hidden] {
    display: none !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f7;
    margin: 0;
    padding: 20px;
    color: #333;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

h1 {
    font-size: 1.2rem;
    margin: 0;
    color: #1c1c1e;
}

h2 {
    margin-top: 0;
}

#settings-btn {
    background: none;
    border: none;
    color: #007aff;
    padding: 0;
    font-size: 1rem;
}

.diagnostic-panel {
    background: #fff7e6;
    border: 1px solid #f5c87a;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.diagnostic-message {
    margin: 0 0 12px;
    color: #6f4d00;
}

.diagnostic-meta {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.diagnostic-meta-row {
    background: rgba(255, 255, 255, 0.65);
    border-radius: 8px;
    padding: 8px 10px;
}

.diagnostic-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pause-banner {
    background: #fff3cd;
    color: #7a5600;
    border: 1px solid #f0d98a;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

#category-filter {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}

#category-filter::-webkit-scrollbar {
    display: none;
}

.category-pill {
    background: white;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.9rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

.category-pill.active {
    background: #007aff;
    color: white;
    border-color: #007aff;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.card-alert {
    border-left: 4px solid #ff3b30;
}

.card-needs-setup {
    border-left: 4px solid #ff9500;
}

.info {
    flex: 1 1 auto;
    min-width: 0;
    display: block;
    padding: 0;
    background: none;
    color: inherit;
    text-align: left;
    font-weight: normal;
}

.name-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    margin-bottom: 4px;
}

.name {
    font-weight: bold;
    font-size: 1.1rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-badge {
    background: #f0f0f2;
    color: #555;
    border-radius: 999px;
    padding: 2px 7px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-line,
.setup-warning {
    display: block;
    font-size: 0.85rem;
}

.status-line {
    color: #666;
}

.setup-warning {
    color: #ff9500;
    font-weight: bold;
}

.alert {
    color: #ff3b30;
    font-weight: bold;
}

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #007aff;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
}

button:active,
.button-link:active {
    opacity: 0.7;
}

.destructive-text-button {
    background: transparent;
    color: #ff3b30;
    padding-inline: 4px;
    margin-right: auto;
}

.secondary-button {
    background: #8e8e93;
}

.danger-button {
    background: #ff3b30;
}

#add-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #34c759;
    font-size: 24px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    width: 85%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
}

.settings-content {
    max-width: 520px;
}

.message-content {
    max-width: 360px;
}

.message-content h2 {
    margin-top: 0;
}

.message-content p {
    white-space: pre-wrap;
    line-height: 1.55;
}

.input-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-top: 10px;
}

.input-help {
    margin: 6px 0 0;
    color: #666;
    font-size: 0.85rem;
}

.input-with-unit {
    display: flex;
    align-items: center;
}

.unit-label {
    font-size: 0.8rem;
    color: #666;
    margin-left: 6px;
    min-width: 36px;
}

input,
select {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
}

.input-with-unit input {
    margin-bottom: 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.card-actions {
    flex: 0 0 72px;
}

.card-actions button {
    width: 100%;
    padding-inline: 10px;
}

.toggle-button {
    background: #e5e5ea;
    color: #333;
    width: auto;
    padding: 6px 16px;
}

.toggle-button.active {
    background: #ff3b30;
    color: white;
}

.settings-section {
    margin-bottom: 16px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.settings-label {
    font-size: 0.95rem;
    font-weight: bold;
}

.settings-subtext {
    font-size: 0.9rem;
    color: #666;
    margin: 6px 0 0;
}

.threshold-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.threshold-control input {
    width: 64px;
    margin: 0;
}

.threshold-control span {
    color: #555;
    font-size: 0.9rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: white;
    border: 1px dashed #c7c7cc;
    border-radius: 12px;
    padding: 20px 16px;
    color: #666;
}

.empty-state strong {
    color: #1c1c1e;
}

.full-width-button {
    box-sizing: border-box;
    width: 100%;
    margin-bottom: 12px;
}

.import-button {
    background: #34c759;
}

.restock-item-name {
    margin-bottom: 16px;
    font-weight: bold;
}

.form-error {
    background: #fff1f0;
    color: #d4380d;
    border: 1px solid #ffa39e;
    border-radius: 8px;
    padding: 10px 12px;
    margin: 0 0 12px;
    font-size: 0.9rem;
}

.data-management {
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    padding: 14px 0;
}

.data-management summary {
    cursor: pointer;
    font-weight: bold;
}

.data-management-content {
    padding-top: 12px;
}
