body {
    font-family: Arial, sans-serif;
    margin: 0;
    background: #f4f4f4;
    color: #222;
}

.header {
    background: #222;
    color: white;
    padding: 18px;
    text-align: center;
}

.container {
    max-width: 700px;
    margin: auto;
    padding: 18px;
}

.button {
    display: block;
    background: white;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #222;
    font-size: 18px;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.tool {
    display: block;
    background: white;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
    text-decoration: none;
    color: #222;
}

.card {
    background: white;
    padding: 18px;
    margin-bottom: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
}

input,
select,
textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    margin: 6px 0 14px 0;
    font-size: 16px;
}

button {
    width: 100%;
    padding: 14px;
    margin-top: 8px;
    font-size: 17px;
    font-weight: bold;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}

.borrow {
    background: #222;
    color: white;
}

.return {
    background: #ddd;
    color: #111;
}

.small {
    color: #666;
    font-size: 14px;
}

.status {
    font-weight: bold;
    margin-top: 8px;
}

.history {
    border-bottom: 1px solid #ddd;
    padding: 10px 0;
}

/* --- Tool thumbnail images --- */

.tool {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tool img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.tool strong {
    font-size: 20px;
}

.tool .status {
    margin-top: 6px;
}

/* --- Tool card text layout --- */

.tool-info {
    flex: 1;
    min-width: 0;
}

.tool-owner {
    margin-top: 4px;
    margin-left: 14px;
    font-size: 14px;
    font-weight: normal;
}

.borrower-name {
    margin-left: 14px;
    font-weight: normal;
}

@media (max-width: 600px) {

    .tool {
        gap: 12px;
        padding: 12px;
    }

    .tool img {
        width: 72px;
        height: 72px;
    }

    .tool strong {
        font-size: 17px;
    }

    .tool-owner {
        margin-left: 10px;
        font-size: 13px;
    }

    .borrower-name {
        margin-left: 10px;
    }
}

/* --- Desktop tool card layout --- */

.tool {
    display: grid;
    grid-template-columns: 100px 1fr 180px;
    align-items: center;
    gap: 16px;

    background: white;
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,.12);
}

.tool img {
    width: 90px;
    height: 90px;
    object-fit: contain;
    border-radius: 8px;
}

.tool-info {
    display: contents;
}

.tool-info > strong {
    grid-column: 2;
    align-self: end;
    font-size: 20px;
}

.tool-owner {
    grid-column: 2;
    align-self: start;
    margin: 2px 0 0 14px;
    font-size: 14px;
    font-weight: normal;
}

.status {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    margin: 0;
    font-weight: bold;
}

.borrower-name {
    margin: 4px 0 0 0;
    font-size: 22px;
    font-weight: bold;
}

/* --- Phone layout --- */

@media (max-width: 600px) {

    .tool {
        grid-template-columns: 72px 1fr;
        gap: 12px;
        padding: 12px;
    }

    .tool img {
        width: 68px;
        height: 68px;
    }

    .tool-info > strong {
        grid-column: 2;
        font-size: 17px;
    }

    .tool-owner {
        grid-column: 2;
        margin-left: 8px;
        font-size: 13px;
    }

    .status {
        grid-column: 2;
        grid-row: auto;
        margin-top: 8px;
    }

    .borrower-name {
        font-size: 19px;
        margin-left: 8px;
    }
}

/* --- Final tool card spacing tweaks --- */

.tool-info > strong {
    align-self: center;
    margin-bottom: 4px;
}

.tool-owner {
    margin-left: 14px;
    margin-top: -2px;
    font-size: 15px;
}

.status {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-self: stretch;
    font-size: 16px;
}

.borrower-name {
    font-size: 24px;
    font-weight: 700;
    margin-top: 4px;
}

@media (max-width: 600px) {

    .tool-owner {
        font-size: 13px;
        margin-left: 8px;
    }

    .status {
        font-size: 14px;
        margin-top: 6px;
    }

    .borrower-name {
        font-size: 20px;
    }
}

/* --- Keep tool name and owner together --- */

.tool-info > strong {
    align-self: end;
    margin-bottom: 2px;
}

.tool-owner {
    align-self: start;
    margin-top: 0;
    margin-left: 14px;
}

/* --- Final tool card layout --- */

.tool-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.tool-details {
    flex: 1;
}

.tool-details strong {
    display: block;
    font-size: 20px;
    margin-bottom: 10px;
}

.tool-owner {
    font-size: 16px;
    margin: 0;
}

.status {
    width: 180px;
    flex-shrink: 0;
    font-size: 17px;
    font-weight: bold;
}

.borrower-name {
    font-size: 23px;
    font-weight: bold;
    margin-top: 3px;
}

/* --- Widen tool details and push status right --- */

.tool-details {
    flex: 1;
    min-width: 0;
}

.status {
    width: 180px;
    margin-left: auto;
}

.tool-info {
    width: 100%;
}

/* ===== FINAL HOME TOOL CARD LAYOUT ===== */

.tool {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr) 180px;
    align-items: center;
    gap: 16px;
    min-height: 110px;
}

.tool-photo {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-photo img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 8px;
    margin: 0;
}

.no-photo {
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f2f2f2;
    border-radius: 8px;
    font-size: 32px;
}

.tool-info {
    grid-column: 2 / 4;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px;
    align-items: center;
    gap: 20px;
}

.tool-details {
    grid-column: 1;
    min-width: 0;
}

.tool-details strong {
    display: block;
    font-size: 20px;
    line-height: 1.2;
    margin: 0 0 8px 0;
}

.tool-owner {
    margin: 0;
    font-size: 15px;
    font-weight: normal;
}

.status {
    grid-column: 2;
    width: auto;
    margin: 0;
    align-self: center;
    font-size: 17px;
    font-weight: bold;
}

.borrower-name {
    margin: 4px 0 0 0;
    font-size: 24px;
    font-weight: bold;
}

/* ===== PHONE LAYOUT ===== */

@media (max-width: 600px) {

    .tool {
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 12px;
        padding: 12px;
        min-height: 90px;
    }

    .tool-photo {
        width: 72px;
        height: 72px;
    }

    .tool-photo img {
        width: 72px;
        height: 72px;
    }

    .no-photo {
        width: 68px;
        height: 68px;
        font-size: 26px;
    }

    .tool-info {
        grid-column: 2;
        display: block;
    }

    .tool-details strong {
        font-size: 17px;
        margin-bottom: 5px;
    }

    .tool-owner {
        font-size: 13px;
    }

    .status {
        margin-top: 9px;
        font-size: 14px;
    }

    .borrower-name {
        font-size: 19px;
    }
}

.tool-details {
    padding-left: 2px;
}

.status {
    margin-top: 6px;
}

.borrower-name {
    font-size: 20px;
    font-weight: 700;
}